Skip to content
  • jcfr's avatar
    COMP: Fix extension packaging setting CMAKE_MACOSX_RPATH to 0 · 1ebed4f5
    jcfr authored
    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
    1ebed4f5