[flang-commits] [PATCH] D136606: [flang] Fix building against clang dylib

Michał Górny via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Oct 25 01:56:33 PDT 2022


mgorny updated this revision to Diff 470412.
mgorny marked an inline comment as done.
mgorny added a comment.

Update to use `CLANG_LINK_CLANG_DYLIB` for the dependency, and to add a dep on `clang-cpp` alternatively to `clangBasic`.


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

https://reviews.llvm.org/D136606

Files:
  flang/lib/Frontend/CMakeLists.txt
  flang/lib/FrontendTool/CMakeLists.txt


Index: flang/lib/FrontendTool/CMakeLists.txt
===================================================================
--- flang/lib/FrontendTool/CMakeLists.txt
+++ flang/lib/FrontendTool/CMakeLists.txt
@@ -5,15 +5,24 @@
   # This makes sure that the MLIR dependencies of flangFrontend (which are
   # transitively required here) are generated before this target is build.
   flangFrontend
-  clangBasic
 
   LINK_LIBS
   flangFrontend
-  clangBasic
-  clangDriver
   MLIRPass
 
   LINK_COMPONENTS
   Option
   Support
 )
+
+if(CLANG_LINK_CLANG_DYLIB)
+  add_dependencies(flangFrontend clang-cpp)
+else()
+  add_dependencies(flangFrontendTool clangBasic)
+endif()
+
+clang_target_link_libraries(flangFrontendTool
+  PRIVATE
+  clangBasic
+  clangDriver
+)
Index: flang/lib/Frontend/CMakeLists.txt
===================================================================
--- flang/lib/Frontend/CMakeLists.txt
+++ flang/lib/Frontend/CMakeLists.txt
@@ -12,7 +12,6 @@
   TextDiagnostic.cpp
 
   DEPENDS
-  clangBasic
   FIRBuilder
   FIRDialect
   FIRSupport
@@ -27,8 +26,6 @@
   FortranEvaluate
   FortranCommon
   FortranLower
-  clangBasic
-  clangDriver
   FIRDialect
   FIRSupport
   FIRBuilder
@@ -50,3 +47,15 @@
   FrontendOpenACC
   FrontendOpenMP
 )
+
+if(CLANG_LINK_CLANG_DYLIB)
+  add_dependencies(flangFrontend clang-cpp)
+else()
+  add_dependencies(flangFrontend clangBasic)
+endif()
+
+clang_target_link_libraries(flangFrontend
+  PRIVATE
+  clangBasic
+  clangDriver
+)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136606.470412.patch
Type: text/x-patch
Size: 1470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20221025/3c8dbb3b/attachment.bin>


More information about the flang-commits mailing list