|
|
@@ -324,9 +324,25 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
|
|
this->LocalGenerator->MaybeRelativeToTopBinDir(dependFileNameFull))
|
|
|
<< "\n";
|
|
|
|
|
|
+ // Scan any custom commands to check if DEPFILE option is specified
|
|
|
+ bool ccGenerateDeps = false;
|
|
|
+ std::vector<cmSourceFile const*> customCommands;
|
|
|
+ this->GeneratorTarget->GetCustomCommands(customCommands,
|
|
|
+ this->GetConfigName());
|
|
|
+ for (cmSourceFile const* sf : customCommands) {
|
|
|
+ if (!sf->GetCustomCommand()->GetDepfile().empty()) {
|
|
|
+ ccGenerateDeps = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
std::string depsUseCompiler = "CMAKE_DEPENDS_USE_COMPILER";
|
|
|
- if (!this->Makefile->IsDefinitionSet(depsUseCompiler) ||
|
|
|
- this->Makefile->IsOn(depsUseCompiler)) {
|
|
|
+ bool compilerGenerateDeps =
|
|
|
+ this->GlobalGenerator->SupportsCompilerDependencies() &&
|
|
|
+ (!this->Makefile->IsDefinitionSet(depsUseCompiler) ||
|
|
|
+ this->Makefile->IsOn(depsUseCompiler));
|
|
|
+
|
|
|
+ if (compilerGenerateDeps || ccGenerateDeps) {
|
|
|
std::string compilerDependFile =
|
|
|
cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.make");
|
|
|
*this->BuildFileStream << "# Include any dependencies generated by the "
|
|
|
@@ -361,7 +377,9 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
|
|
|
"management for "
|
|
|
<< this->GeneratorTarget->GetName() << ".\n";
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ if (compilerGenerateDeps) {
|
|
|
// deactivate no longer needed legacy dependency files
|
|
|
// Write an empty dependency file.
|
|
|
cmGeneratedFileStream legacyDepFileStream(
|