File tree Expand file tree Collapse file tree 13 files changed +90
-13
lines changed Expand file tree Collapse file tree 13 files changed +90
-13
lines changed Original file line number Diff line number Diff line change 1+ set (_boost_deps @BOOST_FIND_PACKAGE@)
2+
3+ foreach (dep ${_boost_deps} )
4+ find_package (${dep} QUIET )
5+ if (${dep} _FOUND)
6+ list (APPEND _boost_deps_found ${dep} )
7+ else ()
8+ list (APPEND _boost_deps_missing ${dep} )
9+ endif ()
10+ endforeach ()
11+
12+ message (STATUS "Boost dependencies found: ${_boost_deps_found} " )
13+ if (_boost_deps_missing)
14+ message (STATUS "Boost dependencies missing: ${_boost_deps_missing} " )
15+ endif ()
16+
17+ unset (_boost_deps)
18+ unset (_boost_deps_found)
19+ unset (_boost_deps_missing)
20+
21+ include ("${CMAKE_CURRENT_LIST_DIR} /BoostTargets.cmake" )
Original file line number Diff line number Diff line change @@ -67,14 +67,16 @@ endforeach()
6767# TODO: Move those to option() calls in the right file
6868if (NOT BOOST_STANDALONE)
6969 # Compilation options required by all platforms
70- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>)
71- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_SYSTEM_NO_DEPRECATED)
72- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_VERSION=4)
73- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_USES_CHRONO)
74- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_PROVIDES_EXECUTORS)
70+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>)
71+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_SYSTEM_NO_DEPRECATED)
72+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_VERSION=4)
73+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_USES_CHRONO)
74+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_THREAD_PROVIDES_EXECUTORS)
7575endif ()
7676
7777if (USE_ANDROID)
7878 # Android doesn't support thread local storage through compiler intrinsics
79- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
79+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
8080endif ()
81+
82+ include (ExportLibraries)
Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ function(_add_boost_lib)
99 set_target_properties (Boost_${BOOSTLIB_NAME} PROPERTIES
1010 OUTPUT_NAME "boost_${BOOSTLIB_NAME} "
1111 FOLDER "Boost"
12+ EXPORT_NAME "${BOOSTLIB_NAME} "
1213 )
1314 if (NOT BOOST_STANDALONE)
1415 set_target_properties (Boost_${BOOSTLIB_NAME} PROPERTIES EXCLUDE_FROM_ALL 1)
1516 endif ()
1617 target_link_libraries (Boost_${BOOSTLIB_NAME} PUBLIC Boost::boost)
18+ install (TARGETS Boost_${BOOSTLIB_NAME} DESTINATION lib EXPORT boost-libs)
1719 if (MSVC )
1820 target_compile_options (Boost_${BOOSTLIB_NAME} PRIVATE /W0)
1921 else ()
Original file line number Diff line number Diff line change 1+ include (CMakePackageConfigHelpers)
2+ write_basic_package_Version_file("BoostConfigVersion.cmake"
3+ VERSION ${BOOST_VERSION}
4+ COMPATIBILITY AnyNewerVersion)
5+
6+ get_property (BOOST_FIND_PACKAGE GLOBAL PROPERTY Boost_Find_Package)
7+ if (BOOST_FIND_PACKAGE)
8+ # The list may be empty
9+ list (REMOVE_DUPLICATES BOOST_FIND_PACKAGE)
10+ endif ()
11+ configure_file ("BoostConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR} /BoostConfig.cmake" @ONLY)
12+
13+ install (FILES
14+ "${CMAKE_CURRENT_BINARY_DIR} /BoostConfig.cmake"
15+ "${CMAKE_CURRENT_BINARY_DIR} /BoostConfigVersion.cmake"
16+ DESTINATION lib/cmake/Boost
17+ )
18+ install (DIRECTORY ${BOOST_SOURCE} /boost
19+ DESTINATION include
20+ )
21+ install (EXPORT boost-libs
22+ DESTINATION lib/cmake/Boost
23+ NAMESPACE Boost::
24+ FILE BoostTargets.cmake
25+ )
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ _add_boost_lib(
1111if (NOT USE_WINDOWS)
1212 find_package (Threads)
1313 target_link_libraries (Boost_chrono PRIVATE Threads::Threads)
14+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Package Threads)
1415
1516 find_library (RT_LIBRARY
1617 NAMES rt
Original file line number Diff line number Diff line change 11# Define the header-only Boost target
2- add_library (Boost::boost INTERFACE IMPORTED GLOBAL )
2+ add_library (Boost_boost INTERFACE )
3+ add_library (Boost::boost ALIAS Boost_boost)
4+ set_target_properties (Boost_boost PROPERTIES
5+ EXPORT_NAME "boost"
6+ )
7+
38if (CMAKE_GENERATOR MATCHES "Xcode" )
49 # The CMake Xcode generator doesn't support system headers directly
5- set_target_properties (Boost::boost PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem;${BOOST_SOURCE} " )
10+ set_target_properties (Boost_boost PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem;${BOOST_SOURCE} " )
611else ()
7- set_target_properties (Boost::boost PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${BOOST_SOURCE} )
8- set_target_properties (Boost::boost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES $ {BOOST_SOURCE} )
12+ set_target_properties (Boost_boost PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${BOOST_SOURCE} )
13+ set_target_properties (Boost_boost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE: $ {BOOST_SOURCE}>;$<INSTALL_INTERFACE:include>" )
914endif ()
15+ install (TARGETS Boost_boost DESTINATION lib EXPORT boost-libs)
1016
1117# Disable autolink
12- set_property (TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ALL_NO_LIB=1)
18+ set_property (TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ALL_NO_LIB=1)
19+
20+ add_library (Boost::boost_imported INTERFACE IMPORTED )
21+ set_target_properties (Boost::boost_imported PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${BOOST_SOURCE} " )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ if(BOOST_IOSTREAMS_ENABLE_BZIP2)
1919 target_link_libraries (Boost_iostreams PRIVATE
2020 BZip2::BZip2
2121 )
22+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Package BZip2)
2223 endif ()
2324endif ()
2425
@@ -32,6 +33,7 @@ if(BOOST_IOSTREAMS_ENABLE_ZLIB)
3233 target_link_libraries (Boost_iostreams PRIVATE
3334 ZLIB::ZLIB
3435 )
36+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Package ZLIB)
3537 endif ()
3638endif ()
3739
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ _add_boost_lib(
5959# Convenience interface library to link deps to both main library and tests
6060add_library (Boost_locale_deps INTERFACE )
6161target_link_libraries (Boost_locale PRIVATE Boost_locale_deps)
62+ install (TARGETS Boost_locale_deps DESTINATION lib EXPORT boost-libs)
6263
6364if (BOOST_LOCALE_ENABLE_ICU_BACKEND AND ICU_FOUND)
6465 target_sources (Boost_locale PRIVATE
@@ -79,6 +80,7 @@ if(BOOST_LOCALE_ENABLE_ICU_BACKEND AND ICU_FOUND)
7980 ICU::uc
8081 )
8182 target_compile_definitions (Boost_locale_deps INTERFACE BOOST_LOCALE_WITH_ICU=1)
83+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Package ICU)
8284endif ()
8385
8486if (BOOST_LOCALE_ENABLE_STD_BACKEND)
@@ -98,6 +100,7 @@ if(BOOST_LOCALE_ENABLE_ICONV_BACKEND AND ICONV_FOUND)
98100 Iconv::Iconv
99101 )
100102 target_compile_definitions (Boost_locale_deps INTERFACE BOOST_LOCALE_WITH_ICONV=1)
103+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Package Iconv)
101104endif ()
102105
103106if (BOOST_LOCALE_ENABLE_WINAPI_BACKEND)
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ endif()
7676try_compile (HAVE_ATOMIC_INT32
7777 "${CMAKE_CURRENT_BINARY_DIR} "
7878 "${BOOST_SOURCE} /libs/log/config/atomic-int32/atomic_int32.cpp"
79- LINK_LIBRARIES Boost::boost
79+ LINK_LIBRARIES Boost::boost_imported
8080)
8181if (NOT HAVE_ATOMIC_INT32)
8282 target_compile_definitions (Boost_log PRIVATE BOOST_LOG_WITHOUT_IPC)
Original file line number Diff line number Diff line change @@ -30,3 +30,4 @@ _add_boost_lib(
3030)
3131target_include_directories (Boost_mpi PUBLIC ${MPI_CXX_INCLUDE_PATH} )
3232target_link_libraries (Boost_mpi PUBLIC ${MPI_CXX_LINK_FLAGS} ${MPI_CXX_LIBRARIES} )
33+ set_property (GLOBAL APPEND PROPERTY Boost_Find_Property MPI)
You can’t perform that action at this time.
0 commit comments