This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Use custom command and target to install libc++ headers
ClosedPublic

Authored by phosek on Mar 22 2018, 12:52 AM.

Details

Summary

Using file(COPY FILE...) has several downsides. Since the file command
is only executed at configuration time, any changes to headers made
after the initial CMake execution are ignored. This can lead to subtle
errors since the just built Clang will be using stale libc++ headers.
Furthermore, since the headers are copied prior to executing the build
system, this may hide missing dependencies on libc++ from other LLVM
components.

This changes replaces the use of file(COPY FILE...) command with a
custom command and target which addresses all aforementioned issues and
matches the implementation already used by other LLVM components that
also install headers like Clang builtin headers.

Diff Detail

Repository
rCXX libc++

Event Timeline

phosek created this revision.Mar 22 2018, 12:52 AM

This changes has already revealed some missing libc++ dependencies in sanitizers which were masked by the use of file(COPY FILE...).

EricWF accepted this revision.Apr 3 2018, 12:00 AM

This LGTM modulo requested changes.

There's a section in NOTES.TXT about the steps required for adding a header. Please update that to mention listing it in CMake.

libcxx/include/CMakeLists.txt
151 ↗(On Diff #139420)

We still want to install the experimental headers even if the experimental library build isn't enabled. Header only components still function.

This revision is now accepted and ready to land.Apr 3 2018, 12:00 AM
phosek updated this revision to Diff 141442.Apr 6 2018, 3:33 PM
phosek marked an inline comment as done.
EricWF added a comment.Apr 8 2018, 3:13 PM

There are a couple of new headers, <version> and <compare> that should be added to the list before committing.

phosek updated this revision to Diff 141580.Apr 8 2018, 9:03 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.