[CMake] Bug 19462 - Use the INSTALL(EXPORT ...) to export CMake definitions

Summary: This patch moves all the clang library targets into a ClangTargets export list, and installs it using the CMake install(EXPORT...) command.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7623

llvm-svn: 238593
This commit is contained in:
Chris Bieneman 2015-05-29 18:36:20 +00:00
parent 7c445dd6c7
commit 8eb2fc8c4a
1 changed files with 3 additions and 1 deletions

View File

@ -365,6 +365,7 @@ macro(add_clang_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
install(TARGETS ${name}
EXPORT ClangTargets
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
RUNTIME DESTINATION bin)
@ -524,9 +525,10 @@ if (CLANG_BUILT_STANDALONE)
# Install a <prefix>/share/clang/cmake/ClangConfig.cmake file so that
# find_package(Clang) works. Install the target list with it.
install(EXPORT ClangTargets DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake
${CLANG_BINARY_DIR}/share/clang/cmake/ClangTargets.cmake
DESTINATION share/clang/cmake)
# Also copy ClangConfig.cmake to the build directory so that dependent projects