[PATCH] D93177: [CMake] Fix BUILD_WITH_INSTALL_RPATH being set when LLVM_LOCAL_RPATH is empty

Raul Tambre via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 13 02:33:43 PST 2020


tambre created this revision.
tambre added reviewers: hans, thakis.
Herald added a subscriber: mgorny.
tambre requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The check if(LLVM_LOCAL_RPATH) is always true as it checks if LLVM_LOCAL_RPATH
is defined, which it always is because llvm/CMakeList.txt unconditionally sets
it to an empty string.
This causes BUILD_WITH_INSTALL_RPATH to always be enabled, which prevents
using a custom rpath only for the build tree. This makes it impossible to run
a runtimes build when compiling LLVM with Clang and wanting the installed rpath
to be empty.

The intention was probably for this to only be done when LLVM_LOCAL_RPATH is
not empty.
However, BUILD_WITH_INSTALL_RPATH is useful to avoid relinking or padding for
the build tree variant, so instead check if CMAKE_BUILD_RPATH is empty to allow
build scenarios like the above, but keep the more performant behaviour
otherwise.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93177

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -865,7 +865,7 @@
 
   if(NOT ARG_NO_INSTALL_RPATH)
     llvm_setup_rpath(${name})
-  elseif (LLVM_LOCAL_RPATH)
+  elseif(CMAKE_BUILD_RPATH STREQUAL "")
     set_target_properties(${name} PROPERTIES
                           BUILD_WITH_INSTALL_RPATH On
                           INSTALL_RPATH "${LLVM_LOCAL_RPATH}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93177.311434.patch
Type: text/x-patch
Size: 502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201213/1568e368/attachment.bin>


More information about the llvm-commits mailing list