Skip to content
Snippets Groups Projects
Commit 4e19e514 authored by Michael Gottesman's avatar Michael Gottesman
Browse files

[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
parent 24d543be
No related branches found
No related tags found
No related merge requests found
...@@ -3,20 +3,24 @@ ...@@ -3,20 +3,24 @@
# the usual CMake convention seems to be ${Project}Targets.cmake. # the usual CMake convention seems to be ${Project}Targets.cmake.
set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake) export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake)
# Install a <prefix>/lib/cmake/clang/ClangConfig.cmake file so that # Generate ClangConfig.cmake for the build tree.
# find_package(Clang) works. Install the target list with it. 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(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
install(FILES install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}) 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment