summaryrefslogtreecommitdiff
path: root/Modules/FindBoost.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-30 14:03:59 -0400
committerBrad King <brad.king@kitware.com>2019-08-30 14:51:03 -0400
commitcf29fa18c8f0e7e482a0668ac1f36d1928080214 (patch)
treee9cfab9d80b4e753635e24afcd3824647bdfcfb3 /Modules/FindBoost.cmake
parentd7df3cd73f00aefd1878d2842ee8b56541ae3c44 (diff)
downloadcmake-cf29fa18c8f0e7e482a0668ac1f36d1928080214.tar.gz
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
Diffstat (limited to 'Modules/FindBoost.cmake')
-rw-r--r--Modules/FindBoost.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index d260ff2cfe..5d20a846cc 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()