[clang] f03b505 - Revert f8990feb125a "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 01:17:13 PDT 2020


Author: Hans Wennborg
Date: 2020-04-28T10:10:33+02:00
New Revision: f03b505ee7f23018493b93e3828fc3672c6f903c

URL: https://github.com/llvm/llvm-project/commit/f03b505ee7f23018493b93e3828fc3672c6f903c
DIFF: https://github.com/llvm/llvm-project/commit/f03b505ee7f23018493b93e3828fc3672c6f903c.diff

LOG: Revert f8990feb125a "[libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON"

This broke builds configured with

$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release '-DLLVM_ENABLE_PROJECTS=clang' '-DLLVM_TARGETS_TO_BUILD=X86' -DLLVM_ENABLE_PIC=OFF ../llvm

CMake Error at
/b/s/w/ir/cache/builder/src/third_party/llvm/clang/tools/libclang/CMakeLists.txt:123
(target_compile_definitions):
    target_compile_definitions called with non-compilable target type

This reverts commit f8990feb125a0f8d3f2892a589bc6fad3c430858.

Added: 
    

Modified: 
    clang/cmake/modules/AddClang.cmake

Removed: 
    


################################################################################
diff  --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index d68218eed073..c1bb386de6f7 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -99,40 +99,38 @@ macro(add_clang_library name)
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  foreach(lib ${name} ${name}_static)
-    if(TARGET ${lib})
-      target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
-
-      if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-        set(export_to_clangtargets)
-        if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-            "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-            NOT LLVM_DISTRIBUTION_COMPONENTS)
-          set(export_to_clangtargets EXPORT ClangTargets)
-          set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
-        endif()
-
-        install(TARGETS ${lib}
-          COMPONENT ${lib}
-          ${export_to_clangtargets}
-          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-          RUNTIME DESTINATION bin)
-
-        if (NOT LLVM_ENABLE_IDE)
-          add_llvm_install_targets(install-${lib}
-                                   DEPENDS ${lib}
-                                   COMPONENT ${lib})
-        endif()
-
-        set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${lib})
+  if(TARGET ${name})
+    target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
+
+    if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+      set(export_to_clangtargets)
+      if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+          "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+          NOT LLVM_DISTRIBUTION_COMPONENTS)
+        set(export_to_clangtargets EXPORT ClangTargets)
+        set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
       endif()
-      set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
-    else()
-      # Add empty "phony" target
-      add_custom_target(${lib})
+
+      install(TARGETS ${name}
+        COMPONENT ${name}
+        ${export_to_clangtargets}
+        LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+        ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+        RUNTIME DESTINATION bin)
+
+      if (NOT LLVM_ENABLE_IDE)
+        add_llvm_install_targets(install-${name}
+                                 DEPENDS ${name}
+                                 COMPONENT ${name})
+      endif()
+
+      set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${name})
     endif()
-  endforeach()
+    set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
+  else()
+    # Add empty "phony" target
+    add_custom_target(${name})
+  endif()
 
   set_target_properties(${name} PROPERTIES FOLDER "Clang libraries")
   set_clang_windows_version_resource_properties(${name})


        


More information about the cfe-commits mailing list