Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -698,6 +698,13 @@ add_subdirectory(utils/TableGen) +# Force target to be built as soon as possible. Clang modules builds depend +# header-wise on it as they ship all headers from the umbrella folders. Building +# an entire module might include header, which depends on intrinsics_gen. This +# should be right after LLVMSupport and LLVMTableGen otherwise we introduce a +# circular dependence. +list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen) + add_subdirectory(include/llvm) add_subdirectory(lib) Index: lib/CodeGen/CMakeLists.txt =================================================================== --- lib/CodeGen/CMakeLists.txt +++ lib/CodeGen/CMakeLists.txt @@ -19,15 +19,6 @@ TransformUtils ) -# In a standard Clang+LLVM build, we need to generate intrinsics before -# building codegen. In a standalone build, LLVM is already built and we don't -# need this dependency. Furthermore, LLVM doesn't export it so we can't have -# this dependency. -set(codegen_deps intrinsics_gen) -if (CLANG_BUILT_STANDALONE) - set(codegen_deps) -endif() - add_clang_library(clangCodeGen BackendUtil.cpp CGAtomic.cpp @@ -80,9 +71,6 @@ SwiftCallingConv.cpp TargetInfo.cpp - DEPENDS - ${codegen_deps} - LINK_LIBS clangAST clangBasic Index: lib/Frontend/CMakeLists.txt =================================================================== --- lib/Frontend/CMakeLists.txt +++ lib/Frontend/CMakeLists.txt @@ -7,11 +7,6 @@ Support ) -set(optional_deps intrinsics_gen) -if (CLANG_BUILT_STANDALONE) - set(optional_deps) -endif() - add_clang_library(clangFrontend ASTConsumers.cpp ASTMerge.cpp @@ -49,7 +44,6 @@ DEPENDS ClangDriverOptions - ${optional_deps} LINK_LIBS clangAST