summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-12-04 12:21:37 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-12-04 13:43:45 (GMT)
commit40dc13b24292354d07b9720d636fa48ab3eee219 (patch)
treeb4de05ab0d2379d1820897ff1179fe3c4885dce4 /Source
parentf61c64cd1cac7c9a6ec93d63647f332a5915da13 (diff)
downloadCMake-40dc13b24292354d07b9720d636fa48ab3eee219.zip
CMake-40dc13b24292354d07b9720d636fa48ab3eee219.tar.gz
CMake-40dc13b24292354d07b9720d636fa48ab3eee219.tar.bz2
cmNinjaTargetGenerator: PCH files do not need dyndep
Fixes: #24209
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 2283923..4025918 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1367,7 +1367,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
!(language == "RC" || (language == "CUDA" && !flag));
int const commandLineLengthLimit =
((lang_supports_response && this->ForceResponseFile())) ? -1 : 0;
- bool const needDyndep =
+ cmValue pchExtension =
+ this->GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
+ bool const isPch = cmHasSuffix(objectFileName, pchExtension);
+ bool const needDyndep = !isPch &&
this->GeneratorTarget->NeedDyndepForSource(language, config, source);
cmNinjaBuild objBuild(this->LanguageCompilerRule(
@@ -1435,13 +1438,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
objBuild.Outputs.push_back(objectFileName);
- if (firstForConfig) {
- cmValue pchExtension =
- this->GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
- if (!cmHasSuffix(objectFileName, pchExtension)) {
- // Add this object to the list of object files.
- this->Configs[config].Objects.push_back(objectFileName);
- }
+ if (firstForConfig && !isPch) {
+ // Add this object to the list of object files.
+ this->Configs[config].Objects.push_back(objectFileName);
}
objBuild.ExplicitDeps.push_back(sourceFilePath);