summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindBoost.cmake15
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage_New/BoostConfig.cmake5
2 files changed, 20 insertions, 0 deletions
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