summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-08-01 13:26:21 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-08-01 13:26:21 (GMT)
commit9e7a0568f604852af6994bebecf580b825b3ae36 (patch)
tree9597c10f96c1bb923cbf001b5724b99bd94804ad /Source/cmMakefileTargetGenerator.cxx
parent0a6415ea1fa286346f119809323938a7cfca8565 (diff)
parent213fec4908a13bb0f414533eddfd72481bc50694 (diff)
downloadCMake-9e7a0568f604852af6994bebecf580b825b3ae36.zip
CMake-9e7a0568f604852af6994bebecf580b825b3ae36.tar.gz
CMake-9e7a0568f604852af6994bebecf580b825b3ae36.tar.bz2
Merge branch 'backport-3.21-CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER' into CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 6af2684..626453f 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -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(