Skip to content

Commit 20e7c0c

Browse files
committedMar 11, 2019
[clang] Add install targets for API headers
Add an install target for clang's API headers, which allows them to be included in distributions. The install rules already existed, but they lacked a component and a target, making them only accessible via a full install. These headers are useful for writing clang-based tooling, for example. They're the clang equivalent to the llvm-headers target and complement the clang-libraries target. Differential Revision: https://reviews.llvm.org/D58317 llvm-svn: 355853
1 parent d7b6813 commit 20e7c0c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
 

Diff for: ‎clang/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ include_directories(BEFORE
388388
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
389389
install(DIRECTORY include/clang include/clang-c
390390
DESTINATION include
391+
COMPONENT clang-headers
391392
FILES_MATCHING
392393
PATTERN "*.def"
393394
PATTERN "*.h"
@@ -397,12 +398,23 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
397398

398399
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
399400
DESTINATION include
401+
COMPONENT clang-headers
400402
FILES_MATCHING
401403
PATTERN "CMakeFiles" EXCLUDE
402404
PATTERN "*.inc"
403405
PATTERN "*.h"
404406
)
405407

408+
# Installing the headers needs to depend on generating any public
409+
# tablegen'd headers.
410+
add_custom_target(clang-headers DEPENDS clang-tablegen-targets)
411+
set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
412+
if(NOT LLVM_ENABLE_IDE)
413+
add_llvm_install_targets(install-clang-headers
414+
DEPENDS clang-headers
415+
COMPONENT clang-headers)
416+
endif()
417+
406418
install(PROGRAMS utils/bash-autocomplete.sh
407419
DESTINATION share/clang
408420
)

Diff for: ‎clang/docs/ReleaseNotes.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ release of Clang. Users of the build system should adjust accordingly.
156156
- In 8.0.0 and below, the install-clang-headers target would install clang's
157157
resource directory headers. This installation is now performed by the
158158
install-clang-resource-headers target. Users of the old install-clang-headers
159-
target should switch to the new install-clang-resource-headers target.
159+
target should switch to the new install-clang-resource-headers target. The
160+
install-clang-headers target now installs clang's API headers (corresponding
161+
to its libraries), which is consistent with the install-llvm-headers target.
160162

161163
- ...
162164

0 commit comments

Comments
 (0)
Please sign in to comment.