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 @@ -188,6 +188,7 @@ endfunction() function(__boost_scan_dependencies lib var) set(result "") + set(required_components "") if(EXISTS "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs/${lib}/CMakeLists.txt") @@ -196,7 +197,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}) @@ -206,13 +207,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() # file(GLOB __boost_libraries RELATIVE "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs" "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs/*/CMakeLists.txt" "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs/numeric/*/CMakeLists.txt") # Check for mistakes in BOOST_INCLUDE_LIBRARIES @@ -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