Skip to content

Commit

Permalink
PR #1709: Handle RPATH CMake configuration
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BotellaA authored and copybara-github committed Jul 11, 2024
1 parent 26ee072 commit cd75cb4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cd75cb4

Please sign in to comment.