[llvm] r353924 - [llvm] [cmake] Provide split include paths in LLVMConfig

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 00:34:40 PST 2019


Author: mgorny
Date: Wed Feb 13 00:34:40 2019
New Revision: 353924

URL: http://llvm.org/viewvc/llvm-project?rev=353924&view=rev
Log:
[llvm] [cmake] Provide split include paths in LLVMConfig

Modify LLVMConfig to provide split variables for in-source and generated
include paths.  Currently, it uses a single value for both
LLVM_INCLUDE_DIRS and LLVM_INCLUDE_DIR which works for install tree but
fails hard at build tree (where LLVM_INCLUDE_DIR incorrectly contains
multiple values).

Instead, put the generated directory in LLVM_INCLUDE_DIR, and the source
tree in LLVM_MAIN_INCLUDE_DIR which is consistent with in-LLVM builds.
For install tree, both variables will have the same value.

Differential Revision: https://reviews.llvm.org/D58109

Modified:
    llvm/trunk/cmake/modules/CMakeLists.txt
    llvm/trunk/cmake/modules/LLVMConfig.cmake.in

Modified: llvm/trunk/cmake/modules/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=353924&r1=353923&r2=353924&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CMakeLists.txt (original)
+++ llvm/trunk/cmake/modules/CMakeLists.txt Wed Feb 13 00:34:40 2019
@@ -41,6 +41,12 @@ set(LLVM_CONFIG_INCLUDE_DIRS
   "${LLVM_MAIN_INCLUDE_DIR}"
   "${LLVM_INCLUDE_DIR}"
   )
+set(LLVM_CONFIG_INCLUDE_DIR
+  "${LLVM_INCLUDE_DIR}"
+  )
+set(LLVM_CONFIG_MAIN_INCLUDE_DIR
+  "${LLVM_MAIN_INCLUDE_DIR}"
+  )
 set(LLVM_CONFIG_LIBRARY_DIRS
   "${LLVM_LIBRARY_DIR}"
   )
@@ -91,6 +97,8 @@ foreach(p ${_count})
 get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
 endforeach(p)
 set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
+set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
 set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
 set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")

Modified: llvm/trunk/cmake/modules/LLVMConfig.cmake.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake.in?rev=353924&r1=353923&r2=353924&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMConfig.cmake.in (original)
+++ llvm/trunk/cmake/modules/LLVMConfig.cmake.in Wed Feb 13 00:34:40 2019
@@ -67,10 +67,12 @@ set(LLVM_LIBDIR_SUFFIX @LLVM_LIBDIR_SUFF
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
 set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
-# These variables are duplicated, but they must match the LLVM variables of the
-# same name. The variables ending in "S" could some day become lists, and are
-# preserved for convention and compatibility.
-set(LLVM_INCLUDE_DIR "@LLVM_CONFIG_INCLUDE_DIRS@")
+# These variables are duplicated for install tree but they have different
+# values for build tree.  LLVM_INCLUDE_DIRS contains both source
+# and generated include directories while the following variables have
+# them split.
+set(LLVM_INCLUDE_DIR "@LLVM_CONFIG_INCLUDE_DIR@")
+set(LLVM_MAIN_INCLUDE_DIR "@LLVM_CONFIG_MAIN_INCLUDE_DIR@")
 set(LLVM_LIBRARY_DIR "@LLVM_CONFIG_LIBRARY_DIRS@")
 
 set(LLVM_DEFINITIONS "@LLVM_DEFINITIONS@")




More information about the llvm-commits mailing list