[PATCH] D146918: [CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_rpath()
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 19 15:56:11 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f833f88ab78: [CMake] Don't set absolute paths as install runpaths on ELF platforms in… (authored by buttaface, committed by JDevlieghere).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146918/new/
https://reviews.llvm.org/D146918
Files:
compiler-rt/cmake/Modules/AddCompilerRT.cmake
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2336,9 +2336,11 @@
# Since BUILD_SHARED_LIBS is only recommended for use by developers,
# hardcode the rpath to build/install lib dir first in this mode.
# FIXME: update this when there is better solution.
- set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_build_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" ${extra_libdir})
+ set(_install_rpath "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
elseif(UNIX)
- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-z,origin ")
@@ -2352,9 +2354,14 @@
return()
endif()
- # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
+ # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not
+ # building for macOS or Windows, as those two platforms seemingly require it.
if("${CMAKE_BUILD_RPATH}" STREQUAL "")
- set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|Windows")
+ set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+ else()
+ set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")
+ endif()
endif()
set_target_properties(${name} PROPERTIES
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -392,8 +392,8 @@
target_link_libraries(${libname} PRIVATE ${builtins_${libname}})
endif()
if(${type} STREQUAL "SHARED")
- if(COMMAND llvm_setup_rpath)
- llvm_setup_rpath(${libname})
+ if(APPLE OR WIN32)
+ set_property(TARGET ${libname} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
endif()
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146918.515116.patch
Type: text/x-patch
Size: 2438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230419/e8cfe40b/attachment.bin>
More information about the llvm-commits
mailing list