[llvm] r280791 - [CMake] Use CMake's default RPATH for the unit tests
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 01:37:15 PDT 2016
Author: rovka
Date: Wed Sep 7 03:37:15 2016
New Revision: 280791
URL: http://llvm.org/viewvc/llvm-project?rev=280791&view=rev
Log:
[CMake] Use CMake's default RPATH for the unit tests
In the top-level CMakeLists.txt, we set CMAKE_BUILD_WITH_INSTALL_RPATH to ON,
and then for the unit tests we set it to <test>/../../lib. This works for tests
that live in unittest/<whatever>, but not for those that live in subdirectories
e.g. unittest/Transforms/IPO or unittest/ExecutionEngine/Orc. When building
with BUILD_SHARED_LIBRARIES, such tests don't manage to find their libraries.
Since the tests are run from the build directory, it makes sense to set their
RPATH for the build tree, rather than the install tree. This is the default in
CMake since 2.6, so all we have to do is set CMAKE_BUILD_WITH_INSTALL_RPATH to
OFF for the unit tests.
Modified:
llvm/trunk/unittests/CMakeLists.txt
Modified: llvm/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=280791&r1=280790&r2=280791&view=diff
==============================================================================
--- llvm/trunk/unittests/CMakeLists.txt (original)
+++ llvm/trunk/unittests/CMakeLists.txt Wed Sep 7 03:37:15 2016
@@ -1,11 +1,9 @@
add_custom_target(UnitTests)
set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
-if (APPLE)
- set(CMAKE_INSTALL_RPATH "@executable_path/../../lib")
-else(UNIX)
- set(CMAKE_INSTALL_RPATH "\$ORIGIN/../../lib${LLVM_LIBDIR_SUFFIX}")
-endif()
+# 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})
More information about the llvm-commits
mailing list