diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-04-30 18:45:19 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-04-30 18:46:21 (GMT) |
commit | ad08f93ee40a1cc855c403c1cc738237511224e3 (patch) | |
tree | db5dfa5149698d1001b1fd3de65d4ffe15439f83 /Source/cmNinjaTargetGenerator.cxx | |
parent | 1ad4501ae97fb6c6deab096ff0ac7e03d554e26d (diff) | |
download | CMake-ad08f93ee40a1cc855c403c1cc738237511224e3.zip CMake-ad08f93ee40a1cc855c403c1cc738237511224e3.tar.gz CMake-ad08f93ee40a1cc855c403c1cc738237511224e3.tar.bz2 |
Ninja Multi-Config: Split long command lines by config
Fixes: #22123
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 672b579..b4838d6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -537,7 +537,8 @@ cmNinjaRule GetScanRule( cmRulePlaceholderExpander::RuleVariables const& vars, const std::string& responseFlag, const std::string& flags, cmRulePlaceholderExpander* const rulePlaceholderExpander, - cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds) + cmLocalNinjaGenerator* generator, std::vector<std::string> scanCmds, + const std::string& outputConfig) { cmNinjaRule rule(ruleName); // Scanning always uses a depfile for preprocessor dependencies. @@ -578,7 +579,8 @@ cmNinjaRule GetScanRule( for (std::string& scanCmd : scanCmds) { rulePlaceholderExpander->ExpandRuleVariables(generator, scanCmd, scanVars); } - rule.Command = generator->BuildCommandLine(scanCmds); + rule.Command = + generator->BuildCommandLine(scanCmds, outputConfig, outputConfig); return rule; } @@ -670,7 +672,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, auto scanRule = GetScanRule( scanRuleName, vars, responseFlag, flags, rulePlaceholderExpander.get(), - this->GetLocalGenerator(), std::move(scanCommands)); + this->GetLocalGenerator(), std::move(scanCommands), config); scanRule.Comment = cmStrCat("Rule for generating ", lang, " dependencies."); @@ -700,7 +702,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, auto scanRule = GetScanRule( scanRuleName, vars, "", flags, rulePlaceholderExpander.get(), - this->GetLocalGenerator(), std::move(scanCommands)); + this->GetLocalGenerator(), std::move(scanCommands), config); // Write the rule for generating dependencies for the given language. scanRule.Comment = cmStrCat("Rule for generating ", lang, @@ -732,7 +734,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, ddModmapArg, " --dd=$out @", rule.RspFile); ddCmds.emplace_back(std::move(ccmd)); } - rule.Command = this->GetLocalGenerator()->BuildCommandLine(ddCmds); + rule.Command = + this->GetLocalGenerator()->BuildCommandLine(ddCmds, config, config); } rule.Comment = cmStrCat("Rule to generate ninja dyndep files for ", lang, '.'); @@ -928,7 +931,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, vars); } - rule.Command = this->GetLocalGenerator()->BuildCommandLine(compileCmds); + rule.Command = + this->GetLocalGenerator()->BuildCommandLine(compileCmds, config, config); // Write the rule for compiling file of the given language. rule.Comment = cmStrCat("Rule for compiling ", lang, " files."); @@ -1246,7 +1250,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( this->ExportObjectCompileCommand( language, sourceFileName, objectDir, objectFileName, objectFileDir, - vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"]); + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config); objBuild.Outputs.push_back(objectFileName); if (firstForConfig) { @@ -1617,7 +1621,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( std::string const& language, std::string const& sourceFileName, std::string const& objectDir, std::string const& objectFileName, std::string const& objectFileDir, std::string const& flags, - std::string const& defines, std::string const& includes) + std::string const& defines, std::string const& includes, + std::string const& outputConfig) { if (!this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS")) { return; @@ -1679,8 +1684,8 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( compileObjectVars); } - std::string cmdLine = - this->GetLocalGenerator()->BuildCommandLine(compileCmds); + std::string cmdLine = this->GetLocalGenerator()->BuildCommandLine( + compileCmds, outputConfig, outputConfig); this->GetGlobalGenerator()->AddCXXCompileCommand(cmdLine, sourceFileName); } |