From: Michael Gottesman Date: Wed, 29 Jun 2016 20:22:44 +0000 (+0000) Subject: [cmake] Move creation of ClangTargets and installation of ClangConfig.cmake from... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c3317aacc986e8b5b624097b178a14eddecd9b6;p=clang [cmake] Move creation of ClangTargets and installation of ClangConfig.cmake from ./CMakeLists.txt -> ./cmake/modules/CMakeLists.txt. This matches LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274157 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a65608954..4601c5523f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -596,28 +596,7 @@ if(APPLE) endif() endif() -# Generate a list of CMake library targets so that other CMake projects can -# link against them. LLVM calls its version of this file LLVMExports.cmake, but -# 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 /lib/cmake/clang/ClangConfig.cmake file so that -# find_package(Clang) works. Install the target list with it. -install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}) - -install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake - DESTINATION lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) - -# 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}/cmake/modules/ClangConfig.cmake - ${CLANG_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake - COPYONLY) +add_subdirectory(cmake/modules) if (CLANG_ENABLE_BOOTSTRAP) include(ExternalProject) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt new file mode 100644 index 0000000000..7906e4f4d2 --- /dev/null +++ b/cmake/modules/CMakeLists.txt @@ -0,0 +1,22 @@ +# Generate a list of CMake library targets so that other CMake projects can +# link against them. LLVM calls its version of this file LLVMExports.cmake, but +# 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 /lib/cmake/clang/ClangConfig.cmake file so that +# find_package(Clang) works. Install the target list with it. +install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR}) + +install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake + DESTINATION lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) + +# 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_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake + COPYONLY)