Index: cfe/trunk/tools/libclang/CMakeLists.txt =================================================================== --- cfe/trunk/tools/libclang/CMakeLists.txt +++ cfe/trunk/tools/libclang/CMakeLists.txt @@ -51,6 +51,9 @@ add_definitions(-DCLANG_TOOL_EXTRA_BUILD) list(APPEND LIBS clangTidyPlugin) list(APPEND LIBS clangIncludeFixerPlugin) + if(LLVM_ENABLE_MODULES) + list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD") + endif() endif () find_library(DL_LIBRARY_PATH dl) @@ -115,6 +118,11 @@ PROPERTIES VERSION ${LIBCLANG_LIBRARY_VERSION} DEFINE_SYMBOL _CINDEX_LIB_) + if(LLVM_ENABLE_MODULES) + target_compile_options(libclang PRIVATE + "-fmodules-ignore-macro=_CINDEX_LIB_" + ) + endif() endif() endif() Index: llvm/trunk/lib/Fuzzer/CMakeLists.txt =================================================================== --- llvm/trunk/lib/Fuzzer/CMakeLists.txt +++ llvm/trunk/lib/Fuzzer/CMakeLists.txt @@ -26,6 +26,10 @@ set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters -Werror") endif() +if(LLVM_ENABLE_MODULES) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-modules") +endif() + # Compile libFuzzer if the compilation is specifically requested, OR # if the platform is known to be working. if ( LLVM_USE_SANITIZE_COVERAGE OR CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux" ) Index: llvm/trunk/tools/gold/CMakeLists.txt =================================================================== --- llvm/trunk/tools/gold/CMakeLists.txt +++ llvm/trunk/tools/gold/CMakeLists.txt @@ -7,6 +7,10 @@ # ABI compatibility. add_definitions( -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ) + if(LLVM_ENABLE_MODULES) + list(APPEND LLVM_COMPILE_FLAGS "-fno-modules") + endif() + set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} Linker Index: llvm/trunk/tools/llvm-config/CMakeLists.txt =================================================================== --- llvm/trunk/tools/llvm-config/CMakeLists.txt +++ llvm/trunk/tools/llvm-config/CMakeLists.txt @@ -59,6 +59,12 @@ # Set build-time environment(s). add_definitions(-DCMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}") +if(LLVM_ENABLE_MODULES) + target_compile_options(llvm-config PUBLIC + "-fmodules-ignore-macro=CMAKE_CFG_INTDIR" + ) +endif() + # Add the dependency on the generation step. add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) Index: llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt =================================================================== --- llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt +++ llvm/trunk/unittests/Support/DynamicLibrary/CMakeLists.txt @@ -2,6 +2,10 @@ add_library(DynamicLibraryLib STATIC ExportedFuncs.cxx) +if(LLVM_ENABLE_MODULES) + target_compile_options(DynamicLibraryLib PRIVATE "-fno-modules") +endif() + add_llvm_unittest(DynamicLibraryTests DynamicLibraryTest.cpp) target_link_libraries(DynamicLibraryTests DynamicLibraryLib) export_executable_symbols(DynamicLibraryTests) @@ -19,6 +23,10 @@ SUFFIX ".so" ) + if(LLVM_ENABLE_MODULES) + target_compile_options(${NAME} PRIVATE "-fno-modules") + endif() + add_dependencies(DynamicLibraryTests ${NAME}) endfunction(dynlib_add_module) Index: llvm/trunk/utils/unittest/CMakeLists.txt =================================================================== --- llvm/trunk/utils/unittest/CMakeLists.txt +++ llvm/trunk/utils/unittest/CMakeLists.txt @@ -45,6 +45,11 @@ list(APPEND LIBS pthread) endif() +# -frtti +if(LLVM_ENABLE_MODULES) + list(APPEND LLVM_COMPILE_FLAGS "-fno-modules") +endif() + add_llvm_library(gtest googletest/src/gtest-all.cc googlemock/src/gmock-all.cc