[CMake] Install rpath handling for iOS frameworks [solved-ish]

Robert Bielik Robert.Bielik at dirac.com
Fri Oct 20 04:40:30 EDT 2017


Ok, this is most certainly not the way to do it, but I added two install steps:

install(CODE "SET(FRAMEWORK_SO \"dummy.framework/dummy\")")
install(SCRIPT add_rpath.cmake COMPONENT frameworks)

add_rpath.cmake:
############
# Adds @rpath to the SO in the framework because CMake install removes it (!!!)
EXECUTE_PROCESS(
    COMMAND install_name_tool -id "@rpath/${FRAMEWORK_SO}" ${FRAMEWORK_SO}
    WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
)
#############

And this works with install target and packaging. But it is ugly.
/R

> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Robert
> Bielik
> Sent: den 20 oktober 2017 08:32
> To: Cmake at cmake.org
> Subject: Re: [CMake] Install rpath handling for iOS frameworks
> 
> Running 3.9.4 I see that behavior related to RPATH on macOS has changed:
> 
> https://cmake.org/cmake/help/v3.9/policy/CMP0068.html
> 
> I've tried setting the policy to OLD, but I'm just not able to get @rpath/... to
> propagate to the install ☹
> 
> Ideas, please ?
> /R
> 
> > -----Original Message-----
> > From: Robert Bielik
> > Sent: den 19 oktober 2017 16:14
> > To: Robert Bielik <Robert.Bielik at dirac.com>; Cmake at cmake.org
> > Subject: RE: Install rpath handling for iOS frameworks
> >
> > Oh, and I just added:
> >
> > SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
> >
> > But it doesn't change anything.
> >
> > /R
> >
> > > -----Original Message-----
> > > From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Robert
> > > Bielik
> > > Sent: den 19 oktober 2017 16:09
> > > To: Cmake at cmake.org
> > > Subject: [CMake] Install rpath handling for iOS frameworks
> > >
> > > I'm trying to package an iOS framework, and with the target setting:
> > >
> > > XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME
> > > "@rpath/$(EXECUTABLE_PATH)"
> > >
> > > I get the framework built nicely. otool -L dummy.framework/dummy
> > shows
> > >
> > >    @rpath/dummy.framework/dummy
> > >
> > > Just as it should. Now I have a install directive:
> > >
> > > install(TARGETS dummy
> > >             FRAMEWORK DESTINATION "./" COMPONENTS frameworks)
> > >
> > > Then I do cpack -G ZIP, and it all packages together without a hitch.
> > > But when I do otool -L of the dummy.framework/dummy from where
> the
> > > package is built I get:
> > >
> > >    dummy.framework/dummy
> > >
> > > i.e. @rpath has been removed during the install process ?
> > >
> > > What am I doing wrong ?
> > >
> > > TIA
> > > /Robert
> > >
> > > --
> > >
> > > Powered by www.kitware.com
> > >
> > > Please keep messages on-topic and check the CMake FAQ at:
> > > http://www.cmake.org/Wiki/CMake_FAQ
> > >
> > > Kitware offers various services to support the CMake community. For
> > > more information on each offering, please visit:
> > >
> > > CMake Support: http://cmake.org/cmake/help/support.html
> > > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > > CMake Training Courses: http://cmake.org/cmake/help/training.html
> > >
> > > Visit other Kitware open-source projects at
> > > http://www.kitware.com/opensource/opensource.html
> > >
> > > Follow this link to subscribe/unsubscribe:
> > > http://public.kitware.com/mailman/listinfo/cmake
> --
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list