RPATH overrides the normal library search path, possibly interfering
with local policy and causing problems for multi-lib, among other issues.
Add an option to avoid setting it with letting it enabled by default.
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
| ... | ... |
@@ -174,13 +174,13 @@ endif() |
| 174 | 174 |
# |
| 175 | 175 |
# Set RPATH for custom install prefixes |
| 176 | 176 |
# |
| 177 |
-if(APPLE) |
|
| 177 |
+if(APPLE AND NOT DO_NOT_SET_RPATH) |
|
| 178 | 178 |
set(CMAKE_MACOSX_RPATH 1) |
| 179 | 179 |
endif() |
| 180 | 180 |
|
| 181 | 181 |
include(GNUInstallDirs) |
| 182 | 182 |
|
| 183 |
-if (NOT DEFINED CMAKE_INSTALL_RPATH) |
|
| 183 |
+if (NOT DEFINED CMAKE_INSTALL_RPATH AND NOT DO_NOT_SET_RPATH) |
|
| 184 | 184 |
if(CMAKE_INSTALL_FULL_LIBDIR) |
| 185 | 185 |
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
|
| 186 | 186 |
else() |
| ... | ... |
@@ -120,3 +120,6 @@ option(ENABLE_SYSTEMD |
| 120 | 120 |
# Rust Targets: https://doc.rust-lang.org/nightly/rustc/platform-support.html |
| 121 | 121 |
option(RUST_COMPILER_TARGET |
| 122 | 122 |
"Use a custom target triple to build the Rust components. Needed for cross-compiling.") |
| 123 |
+ |
|
| 124 |
+option(DO_NOT_SET_RPATH |
|
| 125 |
+ "Don't set the RPATH on UNIX systems.") |
| ... | ... |
@@ -397,6 +397,12 @@ The following is a complete list of CMake options unique to configuring ClamAV: |
| 397 | 397 |
|
| 398 | 398 |
_Default: `ON`_ |
| 399 | 399 |
|
| 400 |
+- `DO_NOT_SET_RPATH`: By default RPATH is set in executeables resulting using |
|
| 401 |
+ paths set at build time instead of using system defaults. By setting this |
|
| 402 |
+ `ON` system defaults are used. |
|
| 403 |
+ |
|
| 404 |
+ _Default: `OFF`_ |
|
| 405 |
+ |
|
| 400 | 406 |
- `ENABLE_WERROR`: Compile time warnings will cause build failures (i.e. |
| 401 | 407 |
`-Werror`) |
| 402 | 408 |
|