[PATCH] D26246: [CMake] Disable rpath for UnitTests

Jonas Hahnfeld via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 00:08:02 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL285881: [CMake] Disable rpath for UnitTests (authored by Hahnfeld).

Changed prior to commit:
  https://reviews.llvm.org/D26246?vs=76712&id=76818#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26246

Files:
  llvm/trunk/cmake/modules/AddLLVM.cmake
  llvm/trunk/unittests/CMakeLists.txt


Index: llvm/trunk/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake
+++ llvm/trunk/cmake/modules/AddLLVM.cmake
@@ -632,7 +632,7 @@
 
 
 macro(add_llvm_executable name)
-  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO" "" "" ${ARGN})
+  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "" ${ARGN})
   llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
 
   # Generate objlib
@@ -662,7 +662,9 @@
     add_executable(${name} ${ALL_FILES})
   endif()
 
-  llvm_setup_rpath(${name})
+  if(NOT ARG_NO_INSTALL_RPATH)
+    llvm_setup_rpath(${name})
+  endif()
 
   if(DEFINED windows_resource_file)
     set_windows_version_resource_properties(${name} ${windows_resource_file})
@@ -990,7 +992,7 @@
   set(LLVM_REQUIRES_RTTI OFF)
 
   list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
-  add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO ${ARGN})
+  add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
   set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
   set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
   # libpthreads overrides some standard library symbols, so main
Index: llvm/trunk/unittests/CMakeLists.txt
===================================================================
--- llvm/trunk/unittests/CMakeLists.txt
+++ llvm/trunk/unittests/CMakeLists.txt
@@ -1,10 +1,6 @@
 add_custom_target(UnitTests)
 set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
 
-# People tend to run the tests _before_ installing, so we don't want the install
-# rpath here.
-set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
-
 function(add_llvm_unittest test_dirname)
   add_unittest(UnitTests ${test_dirname} ${ARGN})
 endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26246.76818.patch
Type: text/x-patch
Size: 1918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161103/3424d168/attachment.bin>


More information about the llvm-commits mailing list