[cmake-developers] Modifying RPATH feature to run tests uninstalled
Alexander Neundorf
neundorf at kde.org
Fri Feb 17 09:31:48 EST 2012
On Friday 17 February 2012, Stephen Kelly wrote:
> Alexander Neundorf wrote:
> > On Friday 17 February 2012, Stephen Kelly wrote:
> > ...
> >
> >> The other issue is regarding setting RPATH for the build step and not
> >> the install step, and what syntax should be used for that.
> >>
> >> The options are:
> >>
> >> a) Change the behaviour of CMAKE_SKIP_RPATH to set the RPATH in the
> >> build
> >>
> >> dir (does this need a policy)
> >>
> >> b) Add the new variable CMAKE_SKIP_INSTALL_RPATH to skip only the
> >>
> >> installation RPATH, but do use it for the build step. (Fits with
> >>
> >> existing CMAKE_SKIP_BUILD_RPATH)
> >>
> >> c) Make the existing CMAKE_SKIP_BUILD_RPATH override CMAKE_SKIP_RPATH if
> >> set to false. (This probably would need a policy)
> >>
> >> My choice is b), but I don't know if there are good reasons for the
> >> others.
> >
> > I'm not sure this would help a lot.
> > Some people (distro packagers) disable RPATH by setting CMAKE_SKIP_RPATH
> > to TRUE.
> > CMAKE_SKIP_RPATH is the big switch which overrides all others. So if this
> > is used, we would still have no RPATH in the build tree.
>
> Are you saying this is a chicken-egg problem?
>
> If CMAKE_SKIP_INSTALL_RPATH is used by our buildsystems and
> CMAKE_SKIP_RPATH is not, distros will learn that they can run unit tests
> if they build their packages with the former instead of the latter.
>
> From my point of view though, the ENVIRONMENT property manipulation solves
> enough of the problem already. It makes 'make test' work.
>
> What it doesn't fix is running a unit test executable directly without
> setting the environment manually or running make install. I don't see why
> that should be expected to work though if the developer disables the RPATH
> stuff. It also doesn't work currently (without wrapper scripts), so nothing
> is really lost.
>
> However, adding CMAKE_SKIP_INSTALL_RPATH would make that work even if a
> developer wanted to disable RPATH, so maybe it's a nice thing to do.
Yes, but this could be done already right now.
We (KDE) could add an option(), which when enabled sets CMAKE_INSTALL_RPATH
empty, and CMAKE_INSTALL_RPATH_USE_LINK_PATH to FALSE. This would be the same
effect.
CMAKE_SKIP_RPATH is intentionally for people who just want to disable RPATH no
matter what the project does.
...maybe we (KDE) could do:
if(CMAKE_SKIP_RPATH)
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(CMAKE_INSTALL_RPATH "")
endif()
... I didn't say that loud, did I ? ;-)
Alex
More information about the cmake-developers
mailing list