Commit 21385900 by Mizux Committed by Copybara-Service

PR #1726: cmake: Fix RUNPATH when using BUILD_WITH_INSTALL_RPATH=True

Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1726

ref: https://cmake.org/cmake/help/latest/prop_tgt/BUILD_WITH_INSTALL_RPATH.html
Merge d7d460773fc94171aba41cd344705e9247a5eb81 into 5ea745c2

Merging this change closes #1726

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1726 from Mizux:master d7d460773fc94171aba41cd344705e9247a5eb81
PiperOrigin-RevId: 655593538
Change-Id: Iedd70d3a8b4f6256664aee26a698d4af0523d6b8
parent 5ea745c2
......@@ -258,6 +258,13 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
elseif(_build_type STREQUAL "static" OR _build_type STREQUAL "shared")
add_library(${_NAME} "")
target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS})
if(APPLE)
set_target_properties(${_NAME} PROPERTIES
INSTALL_RPATH "@loader_path")
elseif(UNIX)
set_target_properties(${_NAME} PROPERTIES
INSTALL_RPATH "$ORIGIN")
endif()
target_link_libraries(${_NAME}
PUBLIC ${ABSL_CC_LIB_DEPS}
PRIVATE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment