diff --git a/include/BoostRoot.cmake b/include/BoostRoot.cmake index e93f90712..063032e8a 100644 --- a/include/BoostRoot.cmake +++ b/include/BoostRoot.cmake @@ -21,7 +21,7 @@ set(__boost_incompatible_libraries "") # Define cache variables if root project -if(CMAKE_SOURCE_DIR STREQUAL Boost_SOURCE_DIR) +if(1) # --with- set(BOOST_INCLUDE_LIBRARIES "" CACHE STRING @@ -200,6 +200,7 @@ endfunction() function(__boost_scan_dependencies lib var) set(result "") + set(required_components "") if(EXISTS "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs/${lib}/CMakeLists.txt") @@ -209,7 +209,8 @@ function(__boost_scan_dependencies lib var) foreach(line IN LISTS data) if(line MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$") + list(APPEND required_components ${CMAKE_MATCH_1}) string(REGEX REPLACE "^numeric_" "numeric/" dep ${CMAKE_MATCH_1}) list(APPEND result ${dep}) @@ -218,13 +218,18 @@ function(__boost_scan_dependencies lib var) endif() + list(REMOVE_DUPLICATES required_components) + list(REMOVE_ITEM required_components boost ${lib}) # due to property_tree and python + if(required_components) + find_package(Boost COMPONENTS ${required_components} REQUIRED CONFIG) + endif() set(${var} ${result} PARENT_SCOPE) endfunction() macro(__boost_add_header_only lib) if(TARGET "boost_${lib}" AND TARGET "Boost::${lib}") get_target_property(__boost_lib_type "boost_${lib}" TYPE) @@ -251,13 +256,13 @@ while(__boost_libs_to_scan) list(REMOVE_DUPLICATES __boost_dependencies) - set(__boost_libs_to_scan ${__boost_dependencies}) if(__boost_libs_to_scan) list(REMOVE_ITEM __boost_libs_to_scan ${__boost_include_libraries}) + list(REMOVE_ITEM __boost_libs_to_scan ${__boost_lib}) endif() list(APPEND __boost_include_libraries ${__boost_libs_to_scan}) endwhile() @@ -362,13 +367,14 @@ if(CMAKE_SKIP_INSTALL_RULES) endif() +if(0) set(CONFIG_INSTALL_DIR "${BOOST_INSTALL_CMAKEDIR}/Boost-${BOOST_SUPERPROJECT_VERSION}") set(CONFIG_FILE_NAME "${CMAKE_CURRENT_LIST_DIR}/../config/BoostConfig.cmake") install(FILES "${CONFIG_FILE_NAME}" DESTINATION "${CONFIG_INSTALL_DIR}") set(CONFIG_VERSION_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/tmpinst/BoostConfigVersion.cmake") if(NOT CMAKE_VERSION VERSION_LESS 3.14) write_basic_package_version_file("${CONFIG_VERSION_FILE_NAME}" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) @@ -385,3 +392,4 @@ else() endif() install(FILES "${CONFIG_VERSION_FILE_NAME}" DESTINATION "${CONFIG_INSTALL_DIR}") +endif() \ No newline at end of file