1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-05 23:35:48 +03:00

Check if target exists when reading target properties

This commit is contained in:
Markus Rickert
2020-12-31 13:48:27 +01:00
committed by Nick Wellnhofer
parent 3aadd27592
commit 3d72e6151e

View File

@@ -19,6 +19,7 @@ set(LIBXSLT_EXSLT_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@"
set(LIBXSLT_EXSLT_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@") set(LIBXSLT_EXSLT_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
macro(select_library_location target basename) macro(select_library_location target basename)
if(TARGET ${target})
foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_IMPLIB) foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_IMPLIB)
get_target_property(${basename}_${property}_DEBUG ${target} ${property}_DEBUG) get_target_property(${basename}_${property}_DEBUG ${target} ${property}_DEBUG)
get_target_property(${basename}_${property}_MINSIZEREL ${target} ${property}_MINSIZEREL) get_target_property(${basename}_${property}_MINSIZEREL ${target} ${property}_MINSIZEREL)
@@ -41,9 +42,11 @@ macro(select_library_location target basename)
set(${basename}_LIBRARY ${${basename}_${property}_DEBUG}) set(${basename}_LIBRARY ${${basename}_${property}_DEBUG})
endif() endif()
endforeach() endforeach()
endif()
endmacro() endmacro()
macro(select_executable_location target basename) macro(select_executable_location target basename)
if(TARGET ${target})
get_target_property(${basename}_IMPORTED_LOCATION_DEBUG ${target} IMPORTED_LOCATION_DEBUG) 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_MINSIZEREL ${target} IMPORTED_LOCATION_MINSIZEREL)
get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE) get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
@@ -58,6 +61,7 @@ macro(select_executable_location target basename)
elseif(${basename}_IMPORTED_LOCATION_DEBUG) elseif(${basename}_IMPORTED_LOCATION_DEBUG)
set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG}) set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG})
endif() endif()
endif()
endmacro() endmacro()
select_library_location(LibXslt::LibXslt LIBXSLT) select_library_location(LibXslt::LibXslt LIBXSLT)