summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-02-09 16:36:16 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-02-09 16:36:16 +0000
commit5778c9eb6301583176a724fccf20fe7f19c36e4f (patch)
treebd9b7f2b38676ad8c7b8d2f79ee2f916241a198a
parent39fcc71463b2ff97bab8bb284405ad27fdca06f8 (diff)
downloadllvm-5778c9eb6301583176a724fccf20fe7f19c36e4f.tar.gz
llvm-5778c9eb6301583176a724fccf20fe7f19c36e4f.tar.bz2
llvm-5778c9eb6301583176a724fccf20fe7f19c36e4f.tar.xz
Export lib and exe build target names from build tree
Record every logical target that we install with install(TARGETS) in a global LLVM_EXPORTS property. Then use the export(TARGETS) command to provide a "LLVMExports.cmake" file that exports logical targets for import into applications directly from our build tree. The "LLVMExports.cmake" file is not meant for direct inclusion by application code but should be included by "LLVMConfig.cmake" in a future change. Contributed by Brad King. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201050 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/modules/AddLLVM.cmake5
-rw-r--r--cmake/modules/CMakeLists.txt4
-rw-r--r--cmake/modules/TableGen.cmake1
3 files changed, 10 insertions, 0 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 63e04619dc..59f92bf3dd 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -199,6 +199,7 @@ macro(add_llvm_library name)
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
@@ -251,6 +252,7 @@ ${name} ignored.")
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
endif()
@@ -301,6 +303,9 @@ macro(add_llvm_tool name)
RUNTIME DESTINATION bin)
endif()
endif()
+ if( LLVM_BUILD_TOOLS )
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endif()
set_target_properties(${name} PROPERTIES FOLDER "Tools")
endmacro(add_llvm_tool name)
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 0620ae87c1..8a42548451 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -1,6 +1,10 @@
set(LLVM_INSTALL_PACKAGE_DIR share/llvm/cmake)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+get_property(LLVM_EXPORTS GLOBAL PROPERTY LLVM_EXPORTS)
+export(TARGETS ${LLVM_EXPORTS}
+ FILE ${llvm_cmake_builddir}/LLVMExports.cmake)
+
get_property(llvm_libs GLOBAL PROPERTY LLVM_LIBS)
foreach(lib ${llvm_libs})
diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake
index 35f1422cc5..8880fe12b4 100644
--- a/cmake/modules/TableGen.cmake
+++ b/cmake/modules/TableGen.cmake
@@ -131,4 +131,5 @@ macro(add_tablegen target project)
EXPORT LLVMExports
RUNTIME DESTINATION bin)
endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
endmacro()