r286181 - cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 15:46:06 PST 2016


Author: bogner
Date: Mon Nov  7 17:46:05 2016
New Revision: 286181

URL: http://llvm.org/viewvc/llvm-project?rev=286181&view=rev
Log:
cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS

We need to apply the same export logic in clang as in llvm for
LLVM_DISTRIBUTION_COMPONENTS, or the clang exports will be invalid
when we use this config.

This makes using distribution components without setting
LLVM_TOOLCHAIN_ONLY=On work correctly.

Modified:
    cfe/trunk/cmake/modules/AddClang.cmake

Modified: cfe/trunk/cmake/modules/AddClang.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/AddClang.cmake?rev=286181&r1=286180&r2=286181&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/AddClang.cmake (original)
+++ cfe/trunk/cmake/modules/AddClang.cmake Mon Nov  7 17:46:05 2016
@@ -89,9 +89,15 @@ macro(add_clang_library name)
     target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
 
     if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
+
+      if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+          NOT LLVM_DISTRIBUTION_COMPONENTS)
+        set(export_to_clangtargets EXPORT ClangTargets)
+      endif()
+
       install(TARGETS ${name}
         COMPONENT ${name}
-        EXPORT ClangTargets
+        ${export_to_clangtargets}
         LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
         ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
         RUNTIME DESTINATION bin)
@@ -128,7 +134,13 @@ macro(add_clang_tool name)
   add_clang_executable(${name} ${ARGN})
 
   if (CLANG_BUILD_TOOLS)
+    if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+        NOT LLVM_DISTRIBUTION_COMPONENTS)
+      set(export_to_clangtargets EXPORT ClangTargets)
+    endif()
+
     install(TARGETS ${name}
+      ${export_to_clangtargets}
       RUNTIME DESTINATION bin
       COMPONENT ${name})
 




More information about the cfe-commits mailing list