diff options
-rw-r--r-- | Modules/Compiler/GNU.cmake | 5 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index bdcaf9d..c74c179 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -30,7 +30,10 @@ macro(__compiler_gnu lang) # in try_compile mode. GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES) - set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MF <DEPFILE>") + # distcc does not transform -o to -MT when invoking the preprocessor + # internally, as it ought to. Work around this bug by setting -MT here + # even though it isn't strictly necessary. + set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT <OBJECT> -MF <DEPFILE>") endif() # Initial configuration flags. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 9acbc67..bea234f 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -331,6 +331,10 @@ cmNinjaTargetGenerator depfile = "$out.d"; cmSystemTools::ReplaceString(depfileFlagsStr, "<DEPFILE>", depfile.c_str()); + cmSystemTools::ReplaceString(depfileFlagsStr, "<OBJECT>", + "$out"); + cmSystemTools::ReplaceString(depfileFlagsStr, "<CMAKE_C_COMPILER>", + this->GetMakefile()->GetDefinition("CMAKE_C_COMPILER")); flags += " " + depfileFlagsStr; } vars.Flags = flags.c_str(); |