diff options
author | Brad King <brad.king@kitware.com> | 2014-07-07 14:58:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-07-07 14:58:43 (GMT) |
commit | 49f32168546ea8f2ef8e6a2e65c114c07edd0e69 (patch) | |
tree | 73f7e3f0c641b359935c3f038af654e084f2914a /Modules/CMakeExpandImportedTargets.cmake | |
parent | 55d6aa36a522f2dd7849ccd53d9e743a88f8c7a1 (diff) | |
download | CMake-49f32168546ea8f2ef8e6a2e65c114c07edd0e69.zip CMake-49f32168546ea8f2ef8e6a2e65c114c07edd0e69.tar.gz CMake-49f32168546ea8f2ef8e6a2e65c114c07edd0e69.tar.bz2 |
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.
Diffstat (limited to 'Modules/CMakeExpandImportedTargets.cmake')
-rw-r--r-- | Modules/CMakeExpandImportedTargets.cmake | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake index 0752e04..b6ab7ef 100644 --- a/Modules/CMakeExpandImportedTargets.cmake +++ b/Modules/CMakeExpandImportedTargets.cmake @@ -71,7 +71,11 @@ function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT ) set(_CCSR_NEW_REQ_LIBS ) set(_CHECK_FOR_IMPORTED_TARGETS FALSE) 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) # message(STATUS "Detected imported target ${_CURRENT_LIB}") # 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). set(_CCSR_NEW_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) list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" ) # message(STATUS "final: appending ${_CURRENT_LIB}") |