summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-05 14:55:49 (GMT)
committerBrad King <brad.king@kitware.com>2014-12-05 14:55:49 (GMT)
commit644b4688d71cc52f8499d6103495de0909319557 (patch)
tree86102a74cc0b93a2b4915089952458d666beb61e /Source/cmLocalUnixMakefileGenerator3.cxx
parent8a4c6d2d2e66d210e5c2d59c86b3f1bff2582867 (diff)
downloadCMake-644b4688d71cc52f8499d6103495de0909319557.zip
CMake-644b4688d71cc52f8499d6103495de0909319557.tar.gz
CMake-644b4688d71cc52f8499d6103495de0909319557.tar.bz2
Makefile: Fix rebuild with multiple custom command outputs (#15116)
Fix the generated makefiles for custom commands with multiple outputs to list all the outputs on the left hand side of the build rule. This is much simpler and more reliable than the old multiple-output-pair infrastructure.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx46
1 files changed, 43 insertions, 3 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ff8ba8b..56b2b97 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -618,6 +618,30 @@ cmLocalUnixMakefileGenerator3
comment);
return;
}
+ std::vector<std::string> outputs(1, target);
+ this->WriteMakeRule(os, comment,
+ outputs, depends, commands,
+ symbolic, in_help);
+}
+
+//----------------------------------------------------------------------------
+void
+cmLocalUnixMakefileGenerator3
+::WriteMakeRule(std::ostream& os,
+ const char* comment,
+ const std::vector<std::string>& outputs,
+ const std::vector<std::string>& depends,
+ const std::vector<std::string>& commands,
+ bool symbolic,
+ bool in_help)
+{
+ // Make sure there is an output.
+ if(outputs.empty())
+ {
+ cmSystemTools::Error("No outputs for WriteMakeRule! called with comment: ",
+ comment);
+ return;
+ }
std::string replace;
@@ -636,8 +660,18 @@ cmLocalUnixMakefileGenerator3
}
// Construct the left hand side of the rule.
- replace = target;
- std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKERULE);
+ std::string tgt;
+ {
+ const char* sep = "";
+ for (std::vector<std::string>::const_iterator i = outputs.begin();
+ i != outputs.end(); ++i)
+ {
+ tgt += sep;
+ tgt += this->Convert(*i,HOME_OUTPUT,MAKERULE);
+ sep = " ";
+ }
+ }
+
const char* space = "";
if(tgt.size() == 1)
{
@@ -690,7 +724,11 @@ cmLocalUnixMakefileGenerator3
// Add the output to the local help if requested.
if(in_help)
{
- this->LocalHelp.push_back(target);
+ for (std::vector<std::string>::const_iterator i = outputs.begin();
+ i != outputs.end(); ++i)
+ {
+ this->LocalHelp.push_back(*i);
+ }
}
}
@@ -1709,6 +1747,8 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
{
+ // Nothing populates multiple output pairs anymore, but we need to
+ // honor it when working in a build tree generated by an older CMake.
cmMakefile* mf = this->Makefile;
// Get the string listing the multiple output pairs.