summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2016-06-29 21:59:14 +0000
committerMichael Gottesman <mgottesman@apple.com>2016-06-29 21:59:14 +0000
commit4e19e514672a6a94019fde624a35d9653dd957d2 (patch)
tree3c107a4333c41817e376cf3fea01b1e3f0fafd79 /cmake
parent24d543be3689fba09cd4afd3fc7f05b930c563a8 (diff)
[cmake] Instead of just copying ClangConfig.cmake, configure it using ClangConfig.cmake.in.
This will allow for cmake to expand variables in ClangConfig.cmake for downstream users. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CMakeLists.txt24
-rw-r--r--cmake/modules/ClangConfig.cmake.in (renamed from cmake/modules/ClangConfig.cmake)0
2 files changed, 14 insertions, 10 deletions
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index f0af3e9da7..0bd630ffce 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -3,20 +3,24 @@
# the usual CMake convention seems to be ${Project}Targets.cmake.
set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)
-# Install a <prefix>/lib/cmake/clang/ClangConfig.cmake file so that
-# find_package(Clang) works. Install the target list with it.
+# Generate ClangConfig.cmake for the build tree.
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
+ ${clang_cmake_builddir}/ClangConfig.cmake
+ @ONLY)
+
+# Generate ClangConfig.cmake for the install tree.
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
+ @ONLY)
+
install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
install(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
-
-# Also copy ClangConfig.cmake to the build directory so that dependent projects
-# can build against a build directory of Clang more easily.
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake
- ${clang_cmake_builddir}/ClangConfig.cmake
- COPYONLY)
diff --git a/cmake/modules/ClangConfig.cmake b/cmake/modules/ClangConfig.cmake.in
index d30a277d22..d30a277d22 100644
--- a/cmake/modules/ClangConfig.cmake
+++ b/cmake/modules/ClangConfig.cmake.in