Load exported lib and exe targets from LLVMConfig

Teach each package configuration file to load the LLVMExports file for
its corresponding tree.  This will allow application CMake code to use
logical library and executable target names from LLVM as if they were in
our own build process (e.g. LLVMSupport).  CMake will have enough
information to propagate LLVM library link dependencies automatically
while configuring applications.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201051 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2014-02-09 16:36:28 +00:00
parent 5778c9eb63
commit 3e308c868e
2 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@ set(LLVM_CONFIG_LIBRARY_DIRS
"${LLVM_LIBRARY_DIR}"
)
set(LLVM_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(LLVM_CONFIG_EXPORTS_FILE "${llvm_cmake_builddir}/LLVMExports.cmake")
configure_file(
LLVMConfig.cmake.in
${llvm_cmake_builddir}/LLVMConfig.cmake
@ -60,6 +61,7 @@ endforeach(p)
set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib")
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
configure_file(
LLVMConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake

View File

@ -43,4 +43,8 @@ set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@")
if(NOT TARGET LLVMSupport)
include("@LLVM_CONFIG_EXPORTS_FILE@")
endif()
include(${LLVM_CMAKE_DIR}/LLVM-Config.cmake)