diff options
author | Arnaud Botella <arnaud.botella@geode-solutions.com> | 2024-07-11 11:23:25 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-07-11 11:24:24 -0700 |
commit | cd75cb4ae32c46c84cef9a9c78b42174f22ed0ac (patch) | |
tree | cec1e436e52db65ea97d989934cf8782c0f7dd0f | |
parent | 26ee072e14dea17fa8870d47cd7e8b4cc1c95e93 (diff) |
PR #1709: Handle RPATH CMake configuration
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1709
When depending on a compiled abseil code, abseil libraries cannot find each other even if they are all located in the same directory.
One fix is to edit the LD_LIBRARY_PATH, but it is not always that simple in a development environment.
Another way is to add the current location into the RPATH so all libraries can find each other. CMake provides simple command to control this at project scale.
Merge caa92e67426784b1537009a24abeaeccba1ca8d4 into cd7f66cab520e99531979b3fd727a25616a1ccbb
Merging this change closes #1709
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1709 from Geode-solutions:master caa92e67426784b1537009a24abeaeccba1ca8d4
PiperOrigin-RevId: 651476097
Change-Id: Ib3f214ac17adabefedfb562127f2b1de413ce437
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 650ed70e..85e0ec3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,10 @@ else() option(ABSL_ENABLE_INSTALL "Enable install rule" ON) endif() +set(CMAKE_INSTALL_RPATH "$ORIGIN") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) +set(CMAKE_BUILD_RPATH_USE_ORIGIN ON) + option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_14) that propagate to targets that link to Abseil" OFF) # TODO: Default to ON for CMake 3.8 and greater. |