Skip to content
Snippets Groups Projects
Commit 23a0b7763696 authored by Markus Rickert's avatar Markus Rickert
Browse files

Check if target exists when reading target properties

parent a84cf441d6ba
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@
set(LIBXSLT_EXSLT_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@")
macro(select_library_location target basename)
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)
......@@ -41,6 +42,7 @@
set(${basename}_LIBRARY ${${basename}_${property}_DEBUG})
endif()
endforeach()
endif()
endmacro()
macro(select_executable_location target basename)
......@@ -44,6 +46,7 @@
endmacro()
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_MINSIZEREL ${target} IMPORTED_LOCATION_MINSIZEREL)
get_target_property(${basename}_IMPORTED_LOCATION_RELEASE ${target} IMPORTED_LOCATION_RELEASE)
......@@ -58,6 +61,7 @@
elseif(${basename}_IMPORTED_LOCATION_DEBUG)
set(${basename}_EXECUTABLE ${${basename}_IMPORTED_LOCATION_DEBUG})
endif()
endif()
endmacro()
select_library_location(LibXslt::LibXslt LIBXSLT)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment