[libxslt] Check if target exists when reading target properties
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Check if target exists when reading target properties
- Date: Fri, 15 Jan 2021 17:42:18 +0000 (UTC)
commit 3d72e6151ede71920808cbc0630e73020cd33efe
Author: Markus Rickert <rickert fortiss org>
Date: Thu Dec 31 13:48:27 2020 +0100
Check if target exists when reading target properties
libxslt-config.cmake.cmake.in | 72 +++++++++++++++++++++++--------------------
1 file changed, 38 insertions(+), 34 deletions(-)
---
diff --git a/libxslt-config.cmake.cmake.in b/libxslt-config.cmake.cmake.in
index b64473f9..31764602 100644
--- a/libxslt-config.cmake.cmake.in
+++ b/libxslt-config.cmake.cmake.in
@@ -19,45 +19,49 @@ set(LIBXSLT_EXSLT_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@"
set(LIBXSLT_EXSLT_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
macro(select_library_location target basename)
- foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_IMPLIB)
- get_target_property(${basename}_${property}_DEBUG ${target} ${property}_DEBUG)
- get_target_property(${basename}_${property}_MINSIZEREL ${target} ${property}_MINSIZEREL)
- get_target_property(${basename}_${property}_RELEASE ${target} ${property}_RELEASE)
- get_target_property(${basename}_${property}_RELWITHDEBINFO ${target}
${property}_RELWITHDEBINFO)
+ if(TARGET ${target})
+ foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_IMPLIB)
+ get_target_property(${basename}_${property}_DEBUG ${target} ${property}_DEBUG)
+ get_target_property(${basename}_${property}_MINSIZEREL ${target}
${property}_MINSIZEREL)
+ get_target_property(${basename}_${property}_RELEASE ${target} ${property}_RELEASE)
+ get_target_property(${basename}_${property}_RELWITHDEBINFO ${target}
${property}_RELWITHDEBINFO)
- if(${basename}_${property}_DEBUG AND ${basename}_${property}_RELEASE)
- set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_RELEASE})
- elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_RELWITHDEBINFO)
- set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_RELWITHDEBINFO})
- elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_MINSIZEREL)
- set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_MINSIZEREL})
- elseif(${basename}_${property}_RELEASE)
- set(${basename}_LIBRARY ${${basename}_${property}_RELEASE})
- elseif(${basename}_${property}_RELWITHDEBINFO)
- set(${basename}_LIBRARY ${${basename}_${property}_RELWITHDEBINFO})
- elseif(${basename}_${property}_MINSIZEREL)
- set(${basename}_LIBRARY ${${basename}_${property}_MINSIZEREL})
- elseif(${basename}_${property}_DEBUG)
- set(${basename}_LIBRARY ${${basename}_${property}_DEBUG})
- endif()
- endforeach()
+ if(${basename}_${property}_DEBUG AND ${basename}_${property}_RELEASE)
+ set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_RELEASE})
+ elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_RELWITHDEBINFO)
+ set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_RELWITHDEBINFO})
+ elseif(${basename}_${property}_DEBUG AND ${basename}_${property}_MINSIZEREL)
+ set(${basename}_LIBRARY debug ${${basename}_${property}_DEBUG} optimized
${${basename}_${property}_MINSIZEREL})
+ elseif(${basename}_${property}_RELEASE)
+ set(${basename}_LIBRARY ${${basename}_${property}_RELEASE})
+ elseif(${basename}_${property}_RELWITHDEBINFO)
+ set(${basename}_LIBRARY ${${basename}_${property}_RELWITHDEBINFO})
+ elseif(${basename}_${property}_MINSIZEREL)
+ set(${basename}_LIBRARY ${${basename}_${property}_MINSIZEREL})
+ elseif(${basename}_${property}_DEBUG)
+ set(${basename}_LIBRARY ${${basename}_${property}_DEBUG})
+ endif()
+ endforeach()
+ endif()
endmacro()
macro(select_executable_location target basename)
- get_target_property(${basename}_IMPORTED_LOCATION_DEBUG ${target} IMPORTED_LOCATION_DEBUG)
- get_target_property(${basename}_IMPORTED_LOCATION_MINSIZEREL ${target} IMPORTED_LOCATION_MINSIZEREL)
- get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
- get_target_property(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO ${target}
IMPORTED_LOCATION_RELWITHDEBINFO)
+ if(TARGET ${target})
+ get_target_property(${basename}_IMPORTED_LOCATION_DEBUG ${target} IMPORTED_LOCATION_DEBUG)
+ get_target_property(${basename}_IMPORTED_LOCATION_MINSIZEREL ${target}
IMPORTED_LOCATION_MINSIZEREL)
+ get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
+ get_target_property(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO ${target}
IMPORTED_LOCATION_RELWITHDEBINFO)
- if(${basename}_IMPORTED_LOCATION_RELEASE)
- set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELEASE})
- elseif(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO)
- set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELWITHDEBINFO})
- elseif(${basename}_IMPORTED_LOCATION_MINSIZEREL)
- set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_MINSIZEREL})
- elseif(${basename}_IMPORTED_LOCATION_DEBUG)
- set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG})
- endif()
+ if(${basename}_IMPORTED_LOCATION_RELEASE)
+ set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELEASE})
+ elseif(${basename}_IMPORTED_LOCATION_RELWITHDEBINFO)
+ set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_RELWITHDEBINFO})
+ elseif(${basename}_IMPORTED_LOCATION_MINSIZEREL)
+ set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_MINSIZEREL})
+ elseif(${basename}_IMPORTED_LOCATION_DEBUG)
+ set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG})
+ endif()
+ endif()
endmacro()
select_library_location(LibXslt::LibXslt LIBXSLT)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]