@@ -122,26 +122,38 @@ function(installLSLApp target)
122122 set (SHAREDLIBCOMPONENT ${target} )
123123 endif ()
124124
125- # Copy lsl library for WIN32 or MacOS.
126- # On Mac, dylib is only needed for macdeployqt and for non bundles when not using system liblsl.
127- # Copy anyway, and fixup_bundle can deal with the dylib already being present.
128- if (NOT TARGET liblsl AND NOT LSL_UNIXFOLDERS)
129- install (FILES $<TARGET_FILE:LSL::lsl>
130- DESTINATION ${CMAKE_INSTALL_BINDIR}
131- COMPONENT ${SHAREDLIBCOMPONENT} )
132- endif ()
133- if (APPLE AND NOT qtapp)
134- # fixup_bundle appears to be broken for Qt apps. Use only for non-Qt.
125+ # For MacOS we need to know if the installed target will be a .app bundle...
126+ if (APPLE )
135127 get_target_property (target_is_bundle ${target} MACOSX_BUNDLE )
136- if (target_is_bundle)
137- install (CODE "
138- include(BundleUtilities)
139- set(BU_CHMOD_BUNDLE_ITEMS ON)
140- fixup_bundle(\$ {CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} /${target} .app \"\" \" ${lsldir} \" )
141- "
142- COMPONENT ${PROJECT_NAME}
143- )
144- endif ()
128+ endif (APPLE )
129+
130+ # Copy lsl library. Logic is a bit complicated.
131+ # If we are not building liblsl, and the (app) target is not using system liblsl
132+ # (LSL_UNIXFOLDERS is maybe a poor proxy for use of system liblsl...),
133+ # then the application needs to have liblsl in an expected location.
134+ if (NOT TARGET liblsl AND NOT LSL_UNIXFOLDERS)
135+ if (APPLE AND target_is_bundle)
136+ # Copy the dylib into the bundle
137+ install (FILES $<TARGET_FILE:LSL::lsl>
138+ DESTINATION ${CMAKE_INSTALL_BINDIR} /${target} .app/Contents/MacOS/
139+ COMPONENT ${SHAREDLIBCOMPONENT} )
140+ else ()
141+ # Copy the dll/dylib/so next to the executable binary.
142+ install (FILES $<TARGET_FILE:LSL::lsl>
143+ DESTINATION ${CMAKE_INSTALL_BINDIR}
144+ COMPONENT ${SHAREDLIBCOMPONENT} )
145+ endif (APPLE AND target_is_bundle)
146+ endif (NOT TARGET liblsl AND NOT LSL_UNIXFOLDERS)
147+ # Mac bundles need further fixup (mostly for 3rd party libs)
148+ # fixup_bundle appears to be broken for Qt apps. Use only for non-Qt.
149+ if (APPLE AND target_is_bundle AND NOT qtapp)
150+ install (CODE "
151+ include(BundleUtilities)
152+ set(BU_CHMOD_BUNDLE_ITEMS ON)
153+ fixup_bundle(\$ {CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} /${target} .app \"\" \" ${lsldir} \" )
154+ "
155+ COMPONENT ${PROJECT_NAME}
156+ )
145157 endif ()
146158
147159 # skip the rest if qt doesn't need to be deployed
0 commit comments