Skip to content

Commit 2138590

Browse files
Mizuxcopybara-github
authored andcommitted
PR #1726: cmake: Fix RUNPATH when using BUILD_WITH_INSTALL_RPATH=True
Imported from GitHub PR #1726 ref: https://cmake.org/cmake/help/latest/prop_tgt/BUILD_WITH_INSTALL_RPATH.html Merge d7d4607 into 5ea745c Merging this change closes #1726 COPYBARA_INTEGRATE_REVIEW=#1726 from Mizux:master d7d4607 PiperOrigin-RevId: 655593538 Change-Id: Iedd70d3a8b4f6256664aee26a698d4af0523d6b8
1 parent 5ea745c commit 2138590

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMake/AbseilHelpers.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
258258
elseif(_build_type STREQUAL "static" OR _build_type STREQUAL "shared")
259259
add_library(${_NAME} "")
260260
target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS})
261+
if(APPLE)
262+
set_target_properties(${_NAME} PROPERTIES
263+
INSTALL_RPATH "@loader_path")
264+
elseif(UNIX)
265+
set_target_properties(${_NAME} PROPERTIES
266+
INSTALL_RPATH "$ORIGIN")
267+
endif()
261268
target_link_libraries(${_NAME}
262269
PUBLIC ${ABSL_CC_LIB_DEPS}
263270
PRIVATE

0 commit comments

Comments
 (0)