From bb0c6105911b307ada3d83f2f2d54ebb493499cc Mon Sep 17 00:00:00 2001 From: Mike Dev Date: Sun, 8 Dec 2019 16:21:30 +0100 Subject: [PATCH] [CMake] Add option for compilation with ICU support --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bce463c4..3e1fe28c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ cmake_minimum_required( VERSION 3.5 ) project( BoostRegex LANGUAGES CXX ) option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF ) +option( BOOST_REGEX_USE_ICU "Enable ICU support in boost regex" OFF ) file( GLOB BOOST_REGEX_SRC ./src/*.cpp ) @@ -34,6 +35,19 @@ target_link_libraries( boost_regex Boost::type_traits ) +if( BOOST_REGEX_USE_ICU ) + if( NOT TARGET ICU::dt ) + # components need to be listed explicitly + find_package( ICU COMPONENTS dt in uc REQUIRED ) + endif() + + target_link_libraries( boost_regex + PRIVATE + ICU::dt ICU::in ICU::uc + ) + target_compile_definitions( boost_regex PRIVATE BOOST_HAS_ICU=1 ) +endif() + if( BOOST_REGEX_INCLUDE_EXAMPLES ) add_subdirectory( example/snippets ) endif()