diff options
author | Brad King <brad.king@kitware.com> | 2020-11-06 16:11:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-11-06 16:43:52 (GMT) |
commit | 43fe7e0c977459ab0e9129b099fb9eee7f2f90e8 (patch) | |
tree | 73b378beaa07cf015d8506df82c83506bee1f203 /Source/cmNinjaTargetGenerator.cxx | |
parent | 1416012f2cd1d385c74eec69e880c0f1b00e9965 (diff) | |
download | CMake-43fe7e0c977459ab0e9129b099fb9eee7f2f90e8.zip CMake-43fe7e0c977459ab0e9129b099fb9eee7f2f90e8.tar.gz CMake-43fe7e0c977459ab0e9129b099fb9eee7f2f90e8.tar.bz2 |
cmNinjaTargetGenerator: Revise conditions to clarify dyndep code paths
All the scan-related code paths are actually about dyndep rather than
explicit preprocessing. It just happens that the implementation for
Fortran requires explicit preprocessing.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index af4f6e1..9db1726 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -624,11 +624,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, cmMakefile* mf = this->GetMakefile(); + // For some cases we scan to dynamically discover dependencies. + bool const needDyndep = this->NeedDyndep(lang); // For some cases we do an explicit preprocessor invocation. bool const explicitPP = this->NeedExplicitPreprocessing(lang); bool const compilePPWithDefines = explicitPP && this->CompileWithDefines(lang); - bool const needDyndep = this->NeedDyndep(lang); std::string flags = "$FLAGS"; @@ -661,7 +662,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - if (explicitPP) { + if (needDyndep) { // Rule to scan dependencies of sources that need preprocessing. { const auto ppScanCommand = GetScanCommand( @@ -702,9 +703,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, this->GetGlobalGenerator()->AddRule(scanRule); } - } - if (needDyndep) { // Write the rule for ninja dyndep file generation. cmNinjaRule rule(this->LanguageDyndepRule(lang, config)); // Command line length is almost always limited -> use response file for @@ -1280,9 +1279,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( // For some cases we need to generate a ninja dyndep file. bool const needDyndep = this->NeedDyndep(language); - // For some cases we do an explicit preprocessor invocation. - bool const explicitPP = this->NeedExplicitPreprocessing(language); - if (explicitPP) { + if (needDyndep) { + // For some cases we do an explicit preprocessor invocation. + bool const explicitPP = this->NeedExplicitPreprocessing(language); // If source/target has preprocessing turned off, we still need to // generate an explicit dependency step @@ -1337,7 +1336,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["INCLUDES"] = cmStrCat(sourceDirectoryFlag, ' ', vars["INCLUDES"]); } - if (firstForConfig && needDyndep) { + if (firstForConfig) { std::string const ddiFile = cmStrCat(objectFileName, ".ddi"); this->Configs[config].DDIFiles[language].push_back(ddiFile); } @@ -1347,8 +1346,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), ppBuild, commandLineLengthLimit); - } - if (needDyndep) { + std::string const dyndep = this->GetDyndepFilePath(language, config); objBuild.OrderOnlyDeps.push_back(dyndep); vars["dyndep"] = dyndep; |