2019-06-16 19:47:22 +02:00
|
|
|
# Copyright 2018-2019 Mike Dev
|
2018-10-02 22:04:12 +02:00
|
|
|
# Distributed under the Boost Software License, Version 1.0.
|
2019-06-16 19:47:22 +02:00
|
|
|
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
|
|
|
#
|
|
|
|
# NOTE: CMake support for Boost.Regex is currently experimental at best
|
|
|
|
# and the interface is likely to change in the future
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-06-16 19:47:22 +02:00
|
|
|
cmake_minimum_required( VERSION 3.5 )
|
|
|
|
project( BoostRegex LANGUAGES CXX )
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-06-16 19:47:22 +02:00
|
|
|
option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF )
|
2019-12-08 16:21:30 +01:00
|
|
|
option( BOOST_REGEX_USE_ICU "Enable ICU support in boost regex" OFF )
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-06-16 19:47:22 +02:00
|
|
|
file( GLOB BOOST_REGEX_SRC ./src/*.cpp )
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-06-16 19:47:22 +02:00
|
|
|
add_library( boost_regex ${BOOST_REGEX_SRC} )
|
|
|
|
add_library( Boost::regex ALIAS boost_regex )
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-12-28 13:51:31 +01:00
|
|
|
# Currently, installation isn't supported directly,
|
|
|
|
# but someone else might install this target from the parent
|
|
|
|
# CMake script, so lets proactively differentiate between
|
|
|
|
# the include directory during regular use (BUILD_INTERFACE)
|
|
|
|
# and after installation
|
|
|
|
target_include_directories( boost_regex
|
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions( boost_regex
|
|
|
|
PUBLIC
|
|
|
|
# No need for autolink and we don't mangle library name anyway
|
|
|
|
BOOST_REGEX_NO_LIB
|
|
|
|
$<$<STREQUAL:$<TARGET_PROPERTY:boost_regex,TYPE>,SHARED_LIBRARY>:BOOST_REGEX_DYN_LINK=1>
|
|
|
|
$<$<STREQUAL:$<TARGET_PROPERTY:boost_regex,TYPE>,STATIC_LIBRARY>:BOOST_REGEX_STATIC_LINK=1>
|
|
|
|
)
|
2018-10-02 22:04:12 +02:00
|
|
|
|
2019-12-28 13:51:31 +01:00
|
|
|
# Specify dependencies (including header-only libraries)
|
2019-06-16 19:47:22 +02:00
|
|
|
target_link_libraries( boost_regex
|
2018-10-02 22:04:12 +02:00
|
|
|
PUBLIC
|
|
|
|
Boost::assert
|
|
|
|
Boost::concept_check
|
|
|
|
Boost::config
|
|
|
|
Boost::container_hash
|
|
|
|
Boost::core
|
|
|
|
Boost::integer
|
|
|
|
Boost::iterator
|
|
|
|
Boost::mpl
|
|
|
|
Boost::predef
|
|
|
|
Boost::smart_ptr
|
|
|
|
Boost::static_assert
|
|
|
|
Boost::throw_exception
|
|
|
|
Boost::type_traits
|
|
|
|
)
|
2019-06-16 19:47:22 +02:00
|
|
|
|
2019-12-08 16:21:30 +01:00
|
|
|
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()
|
|
|
|
|
2019-06-16 19:47:22 +02:00
|
|
|
if( BOOST_REGEX_INCLUDE_EXAMPLES )
|
|
|
|
add_subdirectory( example/snippets )
|
|
|
|
endif()
|
|
|
|
|