Page MenuHomePhabricator

[CMake] Use CMake's default RPATH for the unit tests
ClosedPublic

Authored by rovka on Sep 2 2016, 5:49 AM.

Details

Reviewers
beanz
Summary

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 and
are consequently not run (due to a bug in LIT, this isn't even reported!).

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.

Diff Detail

Event Timeline

rovka updated this revision to Diff 70146.Sep 2 2016, 5:49 AM
rovka retitled this revision from to [CMake] Use CMake's default RPATH for the unit tests.
rovka updated this object.
rovka added a reviewer: beanz.
rovka added a subscriber: llvm-commits.

When building with BUILD_SHARED_LIBRARIES, such tests don't manage
to find their libraries and are consequently not run (due to a bug
in LIT, this isn't even reported!).

This LGTM but wait for Chris' approval too. In our case, LIT doesn't
ignore these tests and the whole build fails. The same is true for
my local builds on a X86_64 host (with BUILD_SHARED_LIBRARIES).
Do you know if something else changed LIT's behaviour?

rovka added a comment.Sep 5 2016, 8:38 AM

This LGTM but wait for Chris' approval too. In our case, LIT doesn't
ignore these tests and the whole build fails. The same is true for
my local builds on a X86_64 host (with BUILD_SHARED_LIBRARIES).
Do you know if something else changed LIT's behaviour?

Yes, looks like r280455 / 280550 made LIT report such errors (same functionality as D24815 that I was going to commit after this went in).

beanz accepted this revision.Sep 6 2016, 11:23 AM
beanz edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 6 2016, 11:23 AM
rovka closed this revision.Sep 12 2016, 1:56 AM

r280791. Thanks.