From df5e9fb18287a6b01adffc39ac49ba351338cd00 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Tue, 26 Dec 2017 22:33:19 -0800 Subject: [PATCH] Fixing Mac build --- CMakeLists.txt | 10 +++++++--- src/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92954a353..ea8e9b207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,9 +55,13 @@ ELSE() SET(QTIOCOMPRESSOR_SRC_DIR ${CMAKE_BINARY_DIR}/QtIOCompressor-src/src) SET(QTIOCOMPRESSOR_INCLUDE_DIRS ${QTIOCOMPRESSOR_SRC_DIR} ${CMAKE_BINARY_DIR}/QtIOCompressor-build) - # Linux needs an additional relative path for bundling the library - IF(UNIX AND NOT APPLE) - SET(QTIOCOMPRESSOR_LIBRARIES -Wl,-rpath,../lib ${QTIOCOMPRESSOR_LIBRARY}) + # Linux/Apple needs an additional relative path for bundling the library + IF(UNIX) + IF(APPLE) + SET(QTIOCOMPRESSOR_LIBRARIES -Wl,-install_name,@rpath/ ${QTIOCOMPRESSOR_LIBRARY}) + ELSE() + SET(QTIOCOMPRESSOR_LIBRARIES -Wl,-rpath,../lib ${QTIOCOMPRESSOR_LIBRARY}) + ENDIF() ENDIF() ENDIF() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e551a28f1..c608d3953 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -276,6 +276,18 @@ IF(APPLE) SET_TARGET_PROPERTIES(mmapper PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in ) # Bundle the libraries with the binary + ADD_CUSTOM_COMMAND( + TARGET mmapper + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/mmapper.app/Contents/Frameworks/) + ADD_CUSTOM_COMMAND( + TARGET mmapper + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${QTIOCOMPRESSOR_LIBRARY} + ${CMAKE_CURRENT_BINARY_DIR}/mmapper.app/Contents/Frameworks/ + ) FIND_PROGRAM(MACDEPLOYQT_APP macdeployqt) MESSAGE(" - macdeployqt path: ${MACDEPLOYQT_APP}") ADD_CUSTOM_COMMAND(