From 8ff43de1a509b779fe6635086e16f6808a4dc765 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Aug 2019 14:34:14 -0400 Subject: FindBoost: Simplify conditional block for last known version A version newer than we know about will be large enough to enter the block for the last known version so we can put the warning there. --- Modules/FindBoost.cmake | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 25dd397..6bb5a1f 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1105,22 +1105,20 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - else() - if(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0) - set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) - set(_Boost_COROUTINE_DEPENDENCIES context) - set(_Boost_FIBER_DEPENDENCIES context) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) - set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - endif() + elseif(NOT Boost_VERSION_STRING VERSION_LESS 1.70.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) if(NOT Boost_VERSION_STRING VERSION_LESS 1.71.0) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() -- cgit v0.12 From d7df3cd73f00aefd1878d2842ee8b56541ae3c44 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Aug 2019 14:47:58 -0400 Subject: FindBoost: Remove incorrect 1.70 timer dependency Running `Utilities/Scripts/BoostScanDeps.cmake` with the Boost 1.70.0 sources shows that the `timer` component no longer depends on `system`. This is consistent with upstream Boost Timer commit `43eecbd071`. --- Modules/FindBoost.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 6bb5a1f..d260ff2 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1116,7 +1116,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) if(NOT Boost_VERSION_STRING VERSION_LESS 1.71.0) -- cgit v0.12 From cf29fa18c8f0e7e482a0668ac1f36d1928080214 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Aug 2019 14:03:59 -0400 Subject: FindBoost: Unwrap compatibility INTERFACE targets for legacy variables Since commit 0dd6772a89 (FindBoost: Add legacy variables and targets for compatibility, 2019-06-14, v3.15.0-rc2~3^2~1) we extract information from imported targets provided by upstream `BoostConfig.cmake` files. However, upstream Boost 1.71 provides some imported targets only for compatibility. They are just INTERFACE libraries that wrap around the real target named by `INTERFACE_LINK_LIBRARIES`. Unwrap this layer so we can extract the real imported location. Fixes: #19656 --- Modules/FindBoost.cmake | 15 +++++++++++++++ .../RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index d260ff2..5d20a84 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -266,6 +266,21 @@ function(_boost_get_existing_target component target_var) foreach(prefix Boost boost) foreach(name IN LISTS names) if(TARGET "${prefix}::${name}") + # The target may be an INTERFACE library that wraps around a single other + # target for compatibility. Unwrap this layer so we can extract real info. + if("${name}" MATCHES "^(python|numpy|mpi_python)([1-9])([0-9])$") + set(name_nv "${CMAKE_MATCH_1}") + if(TARGET "${prefix}::${name_nv}") + get_property(type TARGET "${prefix}::${name}" PROPERTY TYPE) + if(type STREQUAL "INTERFACE_LIBRARY") + get_property(lib TARGET "${prefix}::${name}" PROPERTY INTERFACE_LINK_LIBRARIES) + if("${lib}" STREQUAL "${prefix}::${name_nv}") + set(${target_var} "${prefix}::${name_nv}" PARENT_SCOPE) + return() + endif() + endif() + endif() + endif() set(${target_var} "${prefix}::${name}" PARENT_SCOPE) return() endif() diff --git a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake index 3a88f26..1151514 100644 --- a/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake +++ b/Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake @@ -8,6 +8,7 @@ set_target_properties(Boost::date_time PROPERTIES IMPORTED_CONFIGURATIONS RELEASE IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_date_time.a" ) + set(Boost_python37_FOUND 1) add_library(Boost::python UNKNOWN IMPORTED) set_target_properties(Boost::python PROPERTIES @@ -15,6 +16,10 @@ set_target_properties(Boost::python PROPERTIES IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python_release.a" IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_LIST_DIR}/lib/libboost_python.a" ) +# Versioned target alias for compatibility (added by upstream BoostConfig). +add_library(Boost::python37 INTERFACE IMPORTED) +set_property(TARGET Boost::python37 APPEND PROPERTY INTERFACE_LINK_LIBRARIES Boost::python) + set(Boost_mpi_python2_FOUND 1) add_library(Boost::mpi_python UNKNOWN IMPORTED) set_target_properties(Boost::mpi_python PROPERTIES -- cgit v0.12 From 7828577065afe8cf59434166ae0a0589689caea2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 30 Aug 2019 14:36:32 -0400 Subject: FindBoost: Add support for Boost 1.71 Run `Utilities/Scripts/BoostScanDeps.cmake` with the Boost 1.71.0 sources to compute dependencies. They are the same as Boost 1.70. Fixes: #19658 --- Modules/FindBoost.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 5d20a84..eb4f5e4 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1134,7 +1134,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(NOT Boost_VERSION_STRING VERSION_LESS 1.71.0) + if(NOT Boost_VERSION_STRING VERSION_LESS 1.72.0) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1406,7 +1406,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.70.0" "1.70" "1.69.0" "1.69" + "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" -- cgit v0.12