cmake and RPATH
Alexander Neundorf
neundorf at kde.org
Wed Mar 1 20:35:54 CET 2006
Hi,
On Wednesday 01 March 2006 19:55, you wrote:
> Alexander Neundorf wrote:
> > Ok, how about these options for KDE:
> >
> > 1) Build without RPATH at all:
> >
> > set(CMAKE_SKIP_RPATH ON)
>
> This is correct.
At least one ;-)
> > 2) Build with RPATH to the builddir:
> >
> > # nothing required, no relinking will happen
>
> This is the default, but relinking WILL happen on install to remove the
> rpath or setup the rpath specified by the INSTALL_RPATH target property.
Is there a way to avoid this relinking ?
> > 3) Build with RPATH only to the install dir:
> > set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
> >
> > With this option executables will not run if the libs have not yet been
> > installed.
>
> This option will avoid the relinking for installation.
Do I have to set INSTALL_RPATH explicitely ?
> > 4) Build with RPATH to both install and build dir
> >
> > set_target_properties( kde-config PROPERTIES INSTALL_RPATH
> > "${LIBRARY_OUTPUT_DIR};${LIBRARY_INSTALL_PATH}" )
> >
> > Is this possible ?
> > If yes, will this have the effect that the linker will first look in the
> > builddir and after that in the install dir ? If so, is this the desired
> > order ?
>
> This is not a good idea. First, the INSTALL_RPATH is not used in the
> build tree unless option #3 above is set. Second, this will go back to
> installing binaries that have an rpath pointing back at the build tree.
But it would avoid relinking, it would work without having the libs installed,
and it would work with the libs installed and the builddir removed.
Or are the libs also found if the RPATH points to the builddir, but the
buildir is empty, but the libs are available in the system library
path/LD_LIBRARY_PATH ?
Then this would be equivalent to 2).
> > For 1) and 3): The executables will not run without the libs already
> > installed. For this case simple shell scripts could be created which set
> > (DY)LD_LIBRARY_PATH accordingly, so that these executables can be run by
> > running the small wrapper shell scripts.
> >
> > Do we need all these four options ? Or is our preferred option actually
> > still missing ? Personally I'd like to have option 1) available.
>
> If we go with this:
>
> option(KDE4_BUILD_FOR_DEVELOPER "Enable running from build tree." OFF)
> if(NOT KDE4_BUILD_FOR_DEVELOPER)
> set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
> endif(NOT KDE4_BUILD_FOR_DEVELOPER)
>
> then users who build and install KDE will not have to do anything
> special and the installed binaries will have the proper install-tree
> rpath. Developers who wish to have the option of running from the build
> tree may enable this option at the expense of requiring the automatic
> relinking before installation.
>
> Option #1 is always available because CMake always creates
> CMAKE_SKIP_RPATH as an advanced cache option. Developers may simply
> enable that and then no rpath will be used no matter what the project does.
Does CMAKE_SKIP_RPATH override all other RPATH related options ?
Bye
Alex
--
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
More information about the Kde-buildsystem
mailing list