Commit 1ebed4f5 authored by jcfr's avatar jcfr

COMP: Fix extension packaging setting CMAKE_MACOSX_RPATH to 0

Following the update of the minimum required version of CMake to 3.5,
the policy CMP0042 started to default to NEW leading to CMAKE_MACOSX_RPATH
being initialized to 1 by default.

This had the side-effect of including "@rpath/..." into libraries
installed during the packaing on macOS and prior the fixup script had
a chance to recursively collect, copy and update (aka fixup) the libraries.

This commit also updates the external projects removing patches explicitly
setting CMP0042 to OLD (e.g ITK). Instead, the variable CMAKE_MACOSX_RPATH
is passed to all of them.

A merge request has also been submitted to ITK. See http://review.source.kitware.com/#/c/22581/

Related Slicer commits:
* r25180 (BUG: Extension packaging: Ensure @rpath is not applied at build time)

Related discussions:
* https://discourse.slicer.org/t/interpreting-cdash-reporting-extension-is-packaged-despite-build-errors/856
* https://discourse.slicer.org/t/extension-build-failure-on-mac-due-to-error-copying-files/935


This commit fixes error like this one:

```
[...]
Error copying file "@rpath/libITKFactoryRegistration.dylib" to "/.../SwissSkullStripper-build/_CPack_Packages/Darwin/TGZ/26298-macosx-amd64-SwissSkullStripper-git17391c3-2017-05-16/Slicer.app/Contents/lib/Slicer-4.7/libITKFactoryRegistration.dylib".
warning: target '/.../SwissSkullStripper-build/_CPack_Packages/Darwin/TGZ/26298-macosx-amd64-SwissSkullStripper-git17391c3-2017-05-16/Slicer.app/Contents/lib/Slicer-4.7/libITKFactoryRegistration.dylib' does not exist...
/usr/bin/otool: can't open file: /.../SwissSkullStripper-build/_CPack_Packages/Darwin/TGZ/26298-macosx-amd64-SwissSkullStripper-git17391c3-2017-05-16/Slicer.app/Contents/lib/Slicer-4.7/libITKFactoryRegistration.dylib (No such file or directory)
otool: can't open file: /.../SwissSkullStripper-build/_CPack_Packages/Darwin/TGZ/26298-macosx-amd64-SwissSkullStripper-git17391c3-2017-05-16/Slicer.app/Contents/lib/Slicer-4.7/libITKFactoryRegistration.dylib (No such file or directory)
install_name_tool: can't open file: /.../SwissSkullStripper-build/_CPack_Packages/Darwin/TGZ/26298-macosx-amd64-SwissSkullStripper-git17391c3-2017-05-16/Slicer.app/Contents/lib/Slicer-4.7/libITKFactoryRegistration.dylib (No such file or directory)
[...]
```

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26301 3bd1e089-480b-0410-8dfb-8563597acbee
parent f6ee9c52
......@@ -31,6 +31,8 @@ if(APPLE)
VARS CMAKE_OSX_ARCHITECTURES:STRING CMAKE_OSX_SYSROOT:PATH CMAKE_OSX_DEPLOYMENT_TARGET:STRING
ALL_PROJECTS
)
set(CMAKE_MACOSX_RPATH 0)
endif()
#-----------------------------------------------------------------------------
......
......@@ -123,6 +123,8 @@ if(NOT DEFINED CTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DCTK_USE_QTTESTING:BOOL=${Slicer_USE_QtTesting}
-DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -59,6 +59,8 @@ if(NOT DEFINED CTKAppLauncherLib_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${
# XXX Revisit this when visibility flags will directly be used in Slicer
-DCTKAppLauncher_VISIBILITY_HIDDEN:BOOL=OFF
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -89,6 +89,8 @@ if(NOT DEFINED DCMTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DDCMTK_ENABLE_BUILTIN_DICTIONARY:BOOL=ON
-DDCMTK_ENABLE_PRIVATE_TAGS:BOOL=ON
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -36,12 +36,14 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
)
# ITK release v4.12.0rc1 from 2017.05.09 with
# * KWsys patch to set MACOSX_RPATH based on CMAKE_MACOSX_RPATH
# * Reverted "Slicer patches for CMP0042"
# * Slicer patches for CMP0042
# * MINC patch to support building using redhat devtoolset 2
# * fix DCMTK imageIO orientation bug
ExternalProject_SetIfNotDefined(
${CMAKE_PROJECT_NAME}_${proj}_GIT_TAG
"59e07acdf300d4b3c386f5da45a0b38ef713100f" # slicer-v4.12.0-2017-05-09-2d63918
"4c38b954ccb85f6d016360dfc0000b1b01dca3e8" # slicer-v4.12.0-2017-05-09-2d63918
QUIET
)
......@@ -114,6 +116,8 @@ if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK: QUICK CHANGE
-DITK_WRAP_PYTHON:BOOL=${Slicer_BUILD_ITKPython}
-DExternalData_OBJECT_STORES:PATH=${ExternalData_OBJECT_STORES}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
# VTK
-DModule_ITKVtkGlue:BOOL=ON
-DVTK_DIR:PATH=${VTK_DIR}
......
......@@ -68,6 +68,8 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DARCHIVE_INSTALL_DIR:PATH=${Slicer_INSTALL_LIB_DIR}
-DINCLUDE_INSTALL_DIR:PATH=${Slicer_INSTALL_INCLUDE_DIR}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -81,6 +81,8 @@ if((NOT DEFINED LibArchive_INCLUDE_DIR
-DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARY}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
DEPENDS
${${proj}_DEPENDENCIES}
)
......
......@@ -56,6 +56,8 @@ if(NOT DEFINED OpenIGTLink_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DBUILD_SHARED_LIBS:BOOL=ON
-DOpenIGTLink_PROTOCOL_VERSION_2:BOOL=ON
-DOpenIGTLink_PROTOCOL_VERSION_3:BOOL=ON
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -55,6 +55,8 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DJsonCpp_LIBRARY:PATH=${JsonCpp_LIBRARY}
-DITK_DIR:PATH=${ITK_DIR}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -58,6 +58,8 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DARCHIVE_INSTALL_DIR:PATH=${Slicer_INSTALL_LIB_DIR}
-DINCLUDE_INSTALL_DIR:PATH=${Slicer_INSTALL_INCLUDE_DIR}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -99,6 +99,8 @@ ExternalProject_Execute(${proj} \"install\" \"${PYTHON_EXECUTABLE}\" Packaging/s
-DWRAP_PYTHON:BOOL=ON
-DSimpleITK_BUILD_DISTRIBUTE:BOOL=ON # Shorten version and install path removing -g{GIT-HASH} suffix.
-DExternalData_OBJECT_STORES:PATH=${ExternalData_OBJECT_STORES}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
#
INSTALL_COMMAND ${CMAKE_COMMAND} -P ${_install_script}
#
......
......@@ -111,6 +111,8 @@ if(NOT DEFINED SlicerExecutionModel_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM
-DSlicerExecutionModel_DEFAULT_CLI_TARGETS_FOLDER_PREFIX:STRING=Module-
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -166,6 +166,8 @@ endif()
-DVTK_ENABLE_KITS:BOOL=${VTK_ENABLE_KITS}
-DVTK_RENDERING_BACKEND:STRING=${Slicer_VTK_RENDERING_BACKEND}
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -59,6 +59,8 @@ if((NOT DEFINED BZIP2_INCLUDE_DIR
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DCMAKE_DEBUG_POSTFIX:STRING=
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
DEPENDS
${${proj}_DEPENDENCIES}
)
......
......@@ -93,6 +93,8 @@ if((NOT DEFINED CURL_INCLUDE_DIR
-DCURL_DISABLE_TFTP:BOOL=ON
-DHAVE_LIBIDN:BOOL=FALSE
-DCMAKE_USE_OPENSSL:BOOL=${CURL_ENABLE_SSL}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS}
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -157,6 +157,8 @@ if((NOT DEFINED PYTHON_INCLUDE_DIR
-DENABLE_TKINTER:BOOL=${Slicer_USE_PYTHONQT_WITH_TCL}
-DENABLE_SSL:BOOL=${PYTHON_ENABLE_SSL}
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_ARGS}
${_build_command}
${_install_command}
......
......@@ -65,6 +65,8 @@ if(NOT DEFINED qRestAPI_DIR)
-DBUILD_TESTING:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
${ep_cache_args}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -83,6 +83,8 @@ if(NOT DEFINED Teem_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DPNG_PNG_INCLUDE_DIR:PATH=${PNG_INCLUDE_DIR}
-DTeem_PNG_DLLCONF_IPATH:PATH=${VTK_DIR}/Utilities
${EXTERNAL_PROJECT_OPTIONAL_ARGS}
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
......
......@@ -55,6 +55,8 @@ if(NOT DEFINED zlib_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DZLIB_MANGLE_PREFIX:STRING=slicer_zlib_
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
# macOS
-DCMAKE_MACOSX_RPATH:BOOL=0
DEPENDS
${${proj}_DEPENDENCIES}
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment