This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf839cfda09d: [cmake] Fix clang builds with BUILD_SHARED=ON 
and CLANG_LINK_CLANG_DYLIB=ON (authored by tstellar).

Changed prior to commit:
  https://reviews.llvm.org/D68520?vs=223325&id=239726#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68520/new/

https://reviews.llvm.org/D68520

Files:
  clang/tools/clang-shlib/CMakeLists.txt


Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -14,9 +14,17 @@
     list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
   endif()
   list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
-  list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
+  get_target_property(interface ${lib} LINK_LIBRARIES)
+  if (interface)
+    list(APPEND _DEPS ${interface})
+  endif()
 endforeach ()
 
+# clang libraries are redundant since we are linking all the individual
+# object files into libclang-cpp.so, so filter them out from _DEPS.
+# This avoids problems with LLVM global data when building with
+# BUILD_SHARED_LIBS=ON
+list(FILTER _DEPS EXCLUDE REGEX "^clang")
 if (CLANG_LINK_CLANG_DYLIB)
   set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
 endif()


Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -14,9 +14,17 @@
     list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
   endif()
   list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
-  list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
+  get_target_property(interface ${lib} LINK_LIBRARIES)
+  if (interface)
+    list(APPEND _DEPS ${interface})
+  endif()
 endforeach ()
 
+# clang libraries are redundant since we are linking all the individual
+# object files into libclang-cpp.so, so filter them out from _DEPS.
+# This avoids problems with LLVM global data when building with
+# BUILD_SHARED_LIBS=ON
+list(FILTER _DEPS EXCLUDE REGEX "^clang")
 if (CLANG_LINK_CLANG_DYLIB)
   set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
 endif()
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to