[PATCH] D49486: [cfe][CMake] Export the clang resource directory

Philip Pfaffe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 07:44:35 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.

(Resubmitting because I've subscribed the wrong list, sorry for the noise).


https://reviews.llvm.org/D49486

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: D49486.156071.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180718/82a1f687/attachment.bin>


More information about the cfe-commits mailing list