Fix CMakeLists.txt

This commit is contained in:
Peter Dimov
2020-01-20 16:40:28 +02:00
parent 3b98dc901a
commit 12fd320f3c

View File

@ -41,11 +41,10 @@
##### Current Limitations:
#
# - Doesn't compile or run tests
# - Doesn't support installation
#
cmake_minimum_required( VERSION 3.5 )
project( BoostRegex LANGUAGES CXX )
cmake_minimum_required( VERSION 3.5...3.16 )
project( boost_regex VERSION "${BOOST_SUPERPROJECT_VERSION}" 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 )
@ -55,20 +54,11 @@ file( GLOB BOOST_REGEX_SRC ./src/*.cpp )
add_library( boost_regex ${BOOST_REGEX_SRC} )
add_library( Boost::regex ALIAS boost_regex )
# 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_include_directories( boost_regex PUBLIC include )
target_compile_definitions( boost_regex
PUBLIC
# No need for autolink and we don't mangle library name anyway
# No need for autolink
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>