diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -747,8 +747,12 @@ endif() # Turn on -gsplit-dwarf if requested -if(LLVM_USE_SPLIT_DWARF) - add_definitions("-gsplit-dwarf") +if (LLVM_USE_SPLIT_DWARF) + # Limit to clang and gcc so far. Add compilers supporting this option. + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-gsplit-dwarf) + endif() endif() add_definitions( -D__STDC_CONSTANT_MACROS )