r274176 - [cmake] Instead of just copying ClangConfig.cmake, configure it using ClangConfig.cmake.in.

Michael Gottesman via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 14:59:14 PDT 2016


Author: mgottesman
Date: Wed Jun 29 16:59:14 2016
New Revision: 274176

URL: http://llvm.org/viewvc/llvm-project?rev=274176&view=rev
Log:
[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.

Added:
    cfe/trunk/cmake/modules/ClangConfig.cmake.in
      - copied, changed from r274169, cfe/trunk/cmake/modules/ClangConfig.cmake
Removed:
    cfe/trunk/cmake/modules/ClangConfig.cmake
Modified:
    cfe/trunk/cmake/modules/CMakeLists.txt

Modified: cfe/trunk/cmake/modules/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/CMakeLists.txt?rev=274176&r1=274175&r2=274176&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/CMakeLists.txt (original)
+++ cfe/trunk/cmake/modules/CMakeLists.txt Wed Jun 29 16:59:14 2016
@@ -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)

Removed: cfe/trunk/cmake/modules/ClangConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/ClangConfig.cmake?rev=274175&view=auto
==============================================================================
--- cfe/trunk/cmake/modules/ClangConfig.cmake (original)
+++ cfe/trunk/cmake/modules/ClangConfig.cmake (removed)
@@ -1,10 +0,0 @@
-# This file allows users to call find_package(Clang) and pick up our targets.
-
-# Clang doesn't have any CMake configuration settings yet because it mostly
-# uses LLVM's. When it does, we should move this file to ClangConfig.cmake.in
-# and call configure_file() on it.
-
-find_package(LLVM REQUIRED CONFIG)
-
-# Provide all our library targets to users.
-include("${CMAKE_CURRENT_LIST_DIR}/ClangTargets.cmake")

Copied: cfe/trunk/cmake/modules/ClangConfig.cmake.in (from r274169, cfe/trunk/cmake/modules/ClangConfig.cmake)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/ClangConfig.cmake.in?p2=cfe/trunk/cmake/modules/ClangConfig.cmake.in&p1=cfe/trunk/cmake/modules/ClangConfig.cmake&r1=274169&r2=274176&rev=274176&view=diff
==============================================================================
    (empty)




More information about the cfe-commits mailing list