CMake: Improve finding library name or path of imported targets
Checking LOCATION{_CONFIG} property on interfaces is only supported since CMake 3.19.
Also check the LOCATION and IMPORTED_LIBNAME properties for possible library locations.
Fixes #23632
This commit is contained in:
parent
e1f0a938f6
commit
0f1f61a9c8
1 changed files with 14 additions and 3 deletions
|
|
@ -40,14 +40,25 @@ macro(wx_get_dependencies var lib)
|
|||
else()
|
||||
get_target_property(dep_name ${dep} OUTPUT_NAME)
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
# imported target
|
||||
|
||||
# imported target
|
||||
if(CMAKE_VERSION VERSION_GREATER "3.18")
|
||||
# CMake <= 3.18 only allows a few properties to be checked, not LOCATION, see
|
||||
# https://cmake.org/cmake/help/v3.18/manual/cmake-buildsystem.7.html#interface-libraries
|
||||
set(prop_suffix)
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" prop_suffix)
|
||||
set(prop_suffix "_${prop_suffix}")
|
||||
endif()
|
||||
get_target_property(dep_name ${dep} LOCATION${prop_suffix})
|
||||
if(NOT dep_name AND prop_suffix)
|
||||
get_target_property(dep_name ${dep} LOCATION${prop_suffix})
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
get_target_property(dep_name ${dep} LOCATION)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
get_target_property(dep_name ${dep} IMPORTED_LIBNAME)
|
||||
endif()
|
||||
else()
|
||||
# For the value like $<$<CONFIG:DEBUG>:LIB_PATH>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue