This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when configuring
ClosedPublic

Authored by sdardis on Feb 20 2018, 6:28 AM.

Details

Summary

When libcxx is built in tree for a host which requires libatomic, LLVM's
configuration steps will determine it is required and add it to
CMAKE_REQUIRED_LIBRARIES. When libcxx is later configured, it tests if it
has C++ atomics without libatomic. The test erroneously passes as libatomic
is already part of the set of required libraries.

In turn, a number of the atomic tests will fail as they require libatomic
but the test suite is configured not to use libatomic.

Address this by always dropping libatomic from the set of required libraries
before determining if LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB is true,
then restoring the set of required libraries.

Event Timeline

sdardis created this revision.Feb 20 2018, 6:28 AM
EricWF accepted this revision.Apr 4 2018, 2:07 AM

LGTM.

I would modify the comment to mention that LLVM's configuration may already be adding libatomic

This revision is now accepted and ready to land.Apr 4 2018, 2:07 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review.