RPATH: Add option for using $ORIGIN in build tree
This PR addresses #18413 (closed) by making build RPATHs relative using the $ORIGIN
token. It does not add support for macOS since that platform has quite some unusual characteristics.
TODO:
-
Document CMAKE_BUILD_RPATH_USE_ORIGIN
option -
EnableDeferred.CMAKE_BUILD_RPATH_USE_ORIGIN
by default (allowing the user/project to override it). -
Introduce a new policy that disables this new feature.Deferred. -
New test case: check that an external library outside the build dir does not become relative. Not sure how to do this, can I just link to m
orz
(zlib)?
Tested on Linux only. OpenBSD and DragonFly BSD would be interesting test cases due to the CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG
override.
Edited by Brad King