Skip to content

Commit 4d91a08

Browse files
committed
CMake: install dependencies listed as last installLSLApp parameters
1 parent 6ac9885 commit 4d91a08

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmake/LSLCMake.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ endfunction()
6565

6666
# installLSLApp: adds the specified target to the install list and
6767
# add some quality-of-life improvements for Qt executables
68+
# After the target, additional libraries to install alongside the target can be
69+
# specified, e.g. installLSLApp(FooApp libXY libZ)
6870
function(installLSLApp target)
6971
get_target_property(TARGET_LIBRARIES ${target} LINK_LIBRARIES)
7072
string(REGEX MATCH ";Qt5::" qtapp ";${TARGET_LIBRARIES}")
@@ -88,6 +90,15 @@ function(installLSLApp target)
8890
set(CMAKE_INSTALL_LIBDIR ${PROJECT_NAME})
8991
set(lsldir "\${CMAKE_INSTALL_PREFIX}/LSL")
9092
endif()
93+
94+
# install additional library dependencies supplied after the target argument
95+
foreach(libdependency ${ARGN})
96+
if(NOT TARGET ${libdependency})
97+
message(FATAL_ERROR "Additional arguments to installLSLApp must be library targets, ${libdependency} isn't.")
98+
endif()
99+
install(CODE "file(INSTALL $<TARGET_FILE:${libdependency}> DESTINATION \${CMAKE_INSTALL_PREFIX}/$<IF:$<PLATFORM_ID:Windows>,${CMAKE_INSTALL_BINDIR},${CMAKE_INSTALL_LIBDIR}>)")
100+
endforeach()
101+
91102
set_property(GLOBAL APPEND PROPERTY
92103
"LSLDEPENDS_${PROJECT_NAME}" liblsl)
93104
install(TARGETS ${target} COMPONENT ${PROJECT_NAME}

0 commit comments

Comments
 (0)