[PATCH] D25724: [cmake] Declare LLVM_CMAKE_PATH for use in subprojects

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 05:46:59 PDT 2016

mgorny created this revision.
mgorny added reviewers: beanz, krytarowski.
mgorny added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

Declare the LLVM_CMAKE_PATH to the source directory location of CMake
files, in order to make it possible to easily use them in subprojects.
Such a variable is already declared in most of LLVM projects
(and inconsistently mixed with direct source tree references), including
Clang, LLDB, compiler-rt, libcxx... Declaring it inside main LLVM tree
makes it possible to avoid having to declare fallback values or use
conditionals in those projects.

It should be noted that in some of the subprojects LLVM_CMAKE_PATH is
used to reference generated LLVMConfig.cmake file. However, these
references are conditional to stand-alone builds and explicitly
including this file is unnecessary in combined builds.



Index: lib/LTO/CMakeLists.txt
--- lib/LTO/CMakeLists.txt
+++ lib/LTO/CMakeLists.txt
@@ -21,7 +21,7 @@
 # The VC revision include that we want to generate.
 set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/LLVMLTORevision.h")
-set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GenerateVersionFromCVS.cmake")
+set(get_svn_script "${LLVM_CMAKE_PATH}/GenerateVersionFromCVS.cmake")
 if(DEFINED llvm_vc)
   # Create custom target to generate the VC revision include.
Index: CMakeLists.txt
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -263,6 +263,8 @@
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
 set(LLVM_BINARY_DIR       ${CMAKE_CURRENT_BINARY_DIR}  ) # --prefix
+# Note: LLVM_CMAKE_PATH does not include generated files
+set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25724.74985.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161018/f5c8d6a7/attachment.bin>

More information about the llvm-commits mailing list