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 +) 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 +)