Fold install(...) calls into set_output_dirs

This commit is contained in:
Tim Angus committed 2025-09-11 21:22:42 +01:00
1 parent 3d8979f769
commit f60d07bb55
9 files changed
+27 -15

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
get_directory_property(INSTALL_TARGETS DIRECTORY
${CMAKE_SOURCE_DIR} BUILDSYSTEM_TARGETS)
# Iterate over all the targets that have an INSTALL_DESTINATION
# property (set by set_output_dirs) and call install() on them
foreach(TARGET IN LISTS INSTALL_TARGETS)
get_target_property(DESTINATION ${TARGET} INSTALL_DESTINATION)
if(NOT DESTINATION)
continue()
endif()
install(TARGETS ${TARGET}
RUNTIME DESTINATION ${DESTINATION}
LIBRARY DESTINATION ${DESTINATION}
BUNDLE DESTINATION ${DESTINATION}
ARCHIVE EXCLUDE_FROM_ALL)
endforeach()