Skip to content

Commit cd75cb4

Browse files
BotellaAcopybara-github
authored andcommitted
PR #1709: Handle RPATH CMake configuration
Imported from GitHub PR #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 caa92e6 into cd7f66c Merging this change closes #1709 COPYBARA_INTEGRATE_REVIEW=#1709 from Geode-solutions:master caa92e6 PiperOrigin-RevId: 651476097 Change-Id: Ib3f214ac17adabefedfb562127f2b1de413ce437
1 parent 26ee072 commit cd75cb4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ else()
4141
option(ABSL_ENABLE_INSTALL "Enable install rule" ON)
4242
endif()
4343

44+
set(CMAKE_INSTALL_RPATH "$ORIGIN")
45+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
46+
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
47+
4448
option(ABSL_PROPAGATE_CXX_STD
4549
"Use CMake C++ standard meta features (e.g. cxx_std_14) that propagate to targets that link to Abseil"
4650
OFF) # TODO: Default to ON for CMake 3.8 and greater.

0 commit comments

Comments
 (0)