CMakeExpandImportedTargets: Do not read property on non-target (#15008)
Avoid behavior that is disallowed by CMP0045. Check whether a target exists before trying to read its properties.
This commit is contained in:
parent
55d6aa36a5
commit
49f3216854
@ -71,7 +71,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
|
|||||||
set(_CCSR_NEW_REQ_LIBS )
|
set(_CCSR_NEW_REQ_LIBS )
|
||||||
set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
|
set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
|
||||||
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
||||||
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
if(TARGET "${_CURRENT_LIB}")
|
||||||
|
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
||||||
|
else()
|
||||||
|
set(_importedConfigs "")
|
||||||
|
endif()
|
||||||
if (_importedConfigs)
|
if (_importedConfigs)
|
||||||
# message(STATUS "Detected imported target ${_CURRENT_LIB}")
|
# message(STATUS "Detected imported target ${_CURRENT_LIB}")
|
||||||
# Ok, so this is an imported target.
|
# Ok, so this is an imported target.
|
||||||
@ -123,7 +127,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
|
|||||||
# all remaining imported target names (there shouldn't be any left anyway).
|
# all remaining imported target names (there shouldn't be any left anyway).
|
||||||
set(_CCSR_NEW_REQ_LIBS )
|
set(_CCSR_NEW_REQ_LIBS )
|
||||||
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
||||||
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
if(TARGET "${_CURRENT_LIB}")
|
||||||
|
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
||||||
|
else()
|
||||||
|
set(_importedConfigs "")
|
||||||
|
endif()
|
||||||
if (NOT _importedConfigs)
|
if (NOT _importedConfigs)
|
||||||
list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
|
list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
|
||||||
# message(STATUS "final: appending ${_CURRENT_LIB}")
|
# message(STATUS "final: appending ${_CURRENT_LIB}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user