From: NAKAMURA Takumi Date: Sun, 9 Feb 2014 16:36:28 +0000 (+0000) Subject: Load exported lib and exe targets from LLVMConfig X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=3e308c868e63089c1383dbb6786377eca06a53b1;hp=5778c9eb6301583176a724fccf20fe7f19c36e4f 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 --- diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 8a42548451c..6038cf3355a 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -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 diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in index 4687838a1e8..c1b6450ad68 100644 --- a/cmake/modules/LLVMConfig.cmake.in +++ b/cmake/modules/LLVMConfig.cmake.in @@ -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)