[PATCH] D49478: [cfe][CMake] Export the clang resource directory
Philip Pfaffe via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 05:36:00 PDT 2018
philip.pfaffe created this revision.
philip.pfaffe added reviewers: mgorny, beanz, gottesmm.
Herald added a subscriber: bollu.
Out-of-tree tools trying to parse source files need the builtin headers
such as `stddef.h`. If the tool isn't installed together with clang, it
can't find them automatically. Exporting the location makes this much
easier.
https://reviews.llvm.org/D49478
Files:
clang/cmake/modules/CMakeLists.txt
clang/cmake/modules/ClangConfig.cmake.in
Index: clang/cmake/modules/ClangConfig.cmake.in
===================================================================
--- clang/cmake/modules/ClangConfig.cmake.in
+++ clang/cmake/modules/ClangConfig.cmake.in
@@ -8,6 +8,7 @@
set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")
set(CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@")
set(CLANG_INCLUDE_DIRS "@CLANG_CONFIG_INCLUDE_DIRS@")
+set(CLANG_RESOURCE_DIR "@CLANG_CONFIG_RESOURCE_DIR@")
# Provide all our library targets to users.
include("@CLANG_CONFIG_EXPORTS_FILE@")
Index: clang/cmake/modules/CMakeLists.txt
===================================================================
--- clang/cmake/modules/CMakeLists.txt
+++ clang/cmake/modules/CMakeLists.txt
@@ -19,6 +19,13 @@
"${CLANG_SOURCE_DIR}/include"
"${CLANG_BINARY_DIR}/include"
)
+if (CLANG_RESOURCE_DIR)
+ set(CLANG_CONFIG_RESOURCE_DIR ${CLANG_RESOURCE_DIR})
+else()
+ set(CLANG_CONFIG_RESOURCE_DIR
+ ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
+endif()
+
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
${clang_cmake_builddir}/ClangConfig.cmake
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49478.156055.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/68b5706c/attachment.bin>
More information about the llvm-commits
mailing list