summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-25 14:30:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-08-25 14:31:02 (GMT)
commitea67dbc4cd3cf4d8c02ba4099b4e9600ef93b708 (patch)
tree2d4de816b5081471441b6411a069e1d41bae6443 /Source/cmFileCommand.cxx
parent0b0dc86eab8bbb2b6e1343a89eb4d147714aea19 (diff)
parent27a912193bfe77e400784b152b1cd67003915c37 (diff)
downloadCMake-ea67dbc4cd3cf4d8c02ba4099b4e9600ef93b708.zip
CMake-ea67dbc4cd3cf4d8c02ba4099b4e9600ef93b708.tar.gz
CMake-ea67dbc4cd3cf4d8c02ba4099b4e9600ef93b708.tar.bz2
Merge topic 'file_generate_target'
27a912193b file(GENERATE): Add TARGET argument Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5131
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx35
1 files changed, 25 insertions, 10 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8d20d35..550ad6e 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2240,6 +2240,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
}
void AddEvaluationFile(const std::string& inputName,
+ const std::string& targetName,
const std::string& outputExpr,
const std::string& condition, bool inputIsContent,
cmExecutionStatus& status)
@@ -2255,7 +2256,8 @@ void AddEvaluationFile(const std::string& inputName,
conditionGe.Parse(condition);
status.GetMakefile().AddEvaluationFile(
- inputName, std::move(outputCge), std::move(conditionCge), inputIsContent);
+ inputName, targetName, std::move(outputCge), std::move(conditionCge),
+ inputIsContent);
}
bool HandleGenerateCommand(std::vector<std::string> const& args,
@@ -2269,23 +2271,36 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
status.SetError("Incorrect arguments to GENERATE subcommand.");
return false;
}
+
std::string condition;
- if (args.size() > 5) {
- if (args[5] != "CONDITION") {
+ std::string target;
+
+ for (std::size_t i = 5; i < args.size();) {
+ const std::string& arg = args[i++];
+
+ if (args.size() - i == 0) {
status.SetError("Incorrect arguments to GENERATE subcommand.");
return false;
}
- if (args.size() != 7) {
- status.SetError("Incorrect arguments to GENERATE subcommand.");
+
+ const std::string& value = args[i++];
+
+ if (value.empty()) {
+ status.SetError(
+ arg + " of sub-command GENERATE must not be empty if specified.");
return false;
}
- condition = args[6];
- if (condition.empty()) {
- status.SetError("CONDITION of sub-command GENERATE must not be empty if "
- "specified.");
+
+ if (arg == "CONDITION") {
+ condition = value;
+ } else if (arg == "TARGET") {
+ target = value;
+ } else {
+ status.SetError("Unknown argument to GENERATE subcommand.");
return false;
}
}
+
std::string output = args[2];
const bool inputIsContent = args[3] != "INPUT";
if (inputIsContent && args[3] != "CONTENT") {
@@ -2294,7 +2309,7 @@ bool HandleGenerateCommand(std::vector<std::string> const& args,
}
std::string input = args[4];
- AddEvaluationFile(input, output, condition, inputIsContent, status);
+ AddEvaluationFile(input, target, output, condition, inputIsContent, status);
return true;
}