[llvm] r201049 - Export lib and exe build target names from install tree

NAKAMURA Takumi geek4civic at gmail.com
Sun Feb 9 08:36:04 PST 2014


Author: chapuni
Date: Sun Feb  9 10:36:03 2014
New Revision: 201049

URL: http://llvm.org/viewvc/llvm-project?rev=201049&view=rev
Log:
Export lib and exe build target names from install tree

Use the install(TARGETS) command EXPORT option for every library and
executable that we install with LLVM.  Then use the install(EXPORT)
command to provide a "LLVMExports.cmake" file that exports logical
targets for import into applications from our install 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.

Modified:
    llvm/trunk/cmake/modules/AddLLVM.cmake
    llvm/trunk/cmake/modules/CMakeLists.txt
    llvm/trunk/cmake/modules/TableGen.cmake

Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=201049&r1=201048&r2=201049&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Sun Feb  9 10:36:03 2014
@@ -195,6 +195,7 @@ macro(add_llvm_library name)
   else()
     if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
       install(TARGETS ${name}
+        EXPORT LLVMExports
         LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
         ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
     endif()
@@ -246,6 +247,7 @@ ${name} ignored.")
     else()
       if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
         install(TARGETS ${name}
+          EXPORT LLVMExports
           LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
           ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
       endif()
@@ -294,7 +296,9 @@ macro(add_llvm_tool name)
   list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
   if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     if( LLVM_BUILD_TOOLS )
-      install(TARGETS ${name} RUNTIME DESTINATION bin)
+      install(TARGETS ${name}
+              EXPORT LLVMExports
+              RUNTIME DESTINATION bin)
     endif()
   endif()
   set_target_properties(${name} PROPERTIES FOLDER "Tools")

Modified: llvm/trunk/cmake/modules/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CMakeLists.txt?rev=201049&r1=201048&r2=201049&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CMakeLists.txt (original)
+++ llvm/trunk/cmake/modules/CMakeLists.txt Sun Feb  9 10:36:03 2014
@@ -67,6 +67,8 @@ configure_file(
   ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
   @ONLY)
 
+install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
+
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
   install(FILES
     ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake

Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=201049&r1=201048&r2=201049&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Sun Feb  9 10:36:03 2014
@@ -127,6 +127,8 @@ macro(add_tablegen target project)
   endif()
 
   if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-    install(TARGETS ${target} RUNTIME DESTINATION bin)
+    install(TARGETS ${target}
+            EXPORT LLVMExports
+            RUNTIME DESTINATION bin)
   endif()
 endmacro()





More information about the llvm-commits mailing list