Skip to content

Commit 2baef73

Browse files
committed
CMake: allow packaging shared libraries in a separate component (useful mainly for Windows installers)
1 parent 5baeacb commit 2baef73

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

LSLCMake.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,21 @@ function(installLSLApp target)
113113
if(NOT target_type STREQUAL "EXECUTABLE")
114114
return()
115115
endif()
116+
117+
# Some Windows installers have problems with several components having the same file,
118+
# so libs shared between targets are copied into the SHAREDLIBCOMPONENT component if set
119+
if(NOT SHAREDLIBCOMPONENT)
120+
set(SHAREDLIBCOMPONENT ${target})
121+
endif()
116122

117123
# Copy lsl library for WIN32 or MacOS.
118124
# On Mac, dylib is only needed for macdeployqt and for non bundles when not using system liblsl.
119125
# Copy anyway, and fixup_bundle can deal with the dylib already being present.
120-
installLSLAuxFiles(${target} $<TARGET_FILE:LSL::lsl>)
126+
if(NOT TARGET liblsl AND NOT LSL_UNIXFOLDERS)
127+
install(FILES $<TARGET_FILE:LSL::lsl>
128+
DESTINATION ${CMAKE_INSTALL_BINDIR}
129+
COMPONENT ${SHAREDLIBCOMPONENT})
130+
endif()
121131
if(APPLE AND NOT qtapp)
122132
# fixup_bundle appears to be broken for Qt apps. Use only for non-Qt.
123133
get_target_property(target_is_bundle ${target} MACOSX_BUNDLE)
@@ -158,7 +168,7 @@ function(installLSLApp target)
158168
get_filename_component(_dest \${_dest} DIRECTORY RELATIVE)
159169
file(COPY \${_src} DESTINATION \${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/\${_dest})
160170
endwhile()"
161-
COMPONENT ${target})
171+
COMPONENT ${SHAREDLIBCOMPONENT})
162172
elseif(APPLE)
163173
# It should be enough to call fixup_bundle (see below),
164174
# but this fails to install qt plugins (cocoa).

0 commit comments

Comments
 (0)