[Lldb-commits] [PATCH] D55084: [CMake] Add RPATHS parameter to llvm_add_executable/library
Stefan Gränitz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 29 15:23:53 PST 2018
sgraenitz created this revision.
Herald added a subscriber: mgorny.
This allows to set target-specific LC_RPATH load commands on macOS. It would be useful to locate LLDB.framework in LLDB tools.
Repository:
rL LLVM
https://reviews.llvm.org/D55084
Files:
cmake/modules/AddLLVM.cmake
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -379,7 +379,7 @@
cmake_parse_arguments(ARG
"MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME"
"OUTPUT_NAME;PLUGIN_TOOL"
- "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
+ "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS;RPATHS"
${ARGN})
list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
if(ARG_ADDITIONAL_HEADERS)
@@ -448,12 +448,12 @@
if(ARG_MODULE)
add_library(${name} MODULE ${ALL_FILES})
- llvm_setup_rpath(${name})
+ llvm_setup_rpath(${name} RPATHS ${ARG_RPATHS})
elseif(ARG_SHARED)
add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
add_library(${name} SHARED ${ALL_FILES})
- llvm_setup_rpath(${name})
+ llvm_setup_rpath(${name} RPATHS ${ARG_RPATHS})
else()
add_library(${name} STATIC ${ALL_FILES})
@@ -711,7 +711,7 @@
cmake_parse_arguments(ARG
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
"ENTITLEMENTS"
- "DEPENDS"
+ "DEPENDS;RPATHS"
${ARGN})
llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
@@ -748,7 +748,7 @@
setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
if(NOT ARG_NO_INSTALL_RPATH)
- llvm_setup_rpath(${name})
+ llvm_setup_rpath(${name} RPATHS ${ARG_RPATHS})
endif()
if(DEFINED windows_resource_file)
@@ -1660,17 +1660,11 @@
return()
endif()
- if(LLVM_INSTALL_PREFIX AND NOT (LLVM_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX))
- set(extra_libdir ${LLVM_LIBRARY_DIR})
- elseif(LLVM_BUILD_LIBRARY_DIR)
- set(extra_libdir ${LLVM_LIBRARY_DIR})
- endif()
-
if (APPLE)
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
+ set(_install_rpath_default "@loader_path/../lib")
elseif(UNIX)
- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath_default "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-z,origin ")
@@ -1684,6 +1678,18 @@
return()
endif()
+ if(DEFINED ARG_RPATHS)
+ set(_install_rpath ${ARG_RPATHS})
+ else()
+ set(_install_rpath ${_install_rpath_default})
+ endif()
+
+ if(LLVM_INSTALL_PREFIX AND NOT (LLVM_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX))
+ list(APPEND _install_rpath ${LLVM_LIBRARY_DIR})
+ elseif(LLVM_BUILD_LIBRARY_DIR)
+ list(APPEND _install_rpath ${LLVM_LIBRARY_DIR})
+ endif()
+
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH On
INSTALL_RPATH "${_install_rpath}"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55084.175954.patch
Type: text/x-patch
Size: 2895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181129/8bad921f/attachment.bin>
More information about the lldb-commits
mailing list