[CMake] Use CMake's default RPATH for the unit tests
authorDiana Picus <diana.picus@linaro.org>
Wed, 7 Sep 2016 08:37:15 +0000 (08:37 +0000)
committerDiana Picus <diana.picus@linaro.org>
Wed, 7 Sep 2016 08:37:15 +0000 (08:37 +0000)
commit42431e7ce7e41e8acf0b38465a73bebd6fd63751
tree149e4fddde6a495327e188f0dc713827da01b26b
parentbf1837d9c9791a1c4e5b1f90a29ecc0f6c9333dc
[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.

llvm-svn: 280791
llvm/unittests/CMakeLists.txt