summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorDaniel Eiband <daniel.eiband@brainlab.com>2019-09-14 12:16:14 (GMT)
committerDaniel Eiband <daniel.eiband@brainlab.com>2019-09-17 20:50:25 (GMT)
commitf1e846fddece96d76d4d6b53ff1ca8ed197af550 (patch)
treea146e9f6fb19a665c92e1dc02526dedb86610050 /Source/cmMakefile.cxx
parent4926ab24542d2c9e644feee88efd4a96f8bcab97 (diff)
downloadCMake-f1e846fddece96d76d4d6b53ff1ca8ed197af550.zip
CMake-f1e846fddece96d76d4d6b53ff1ca8ed197af550.tar.gz
CMake-f1e846fddece96d76d4d6b53ff1ca8ed197af550.tar.bz2
cmMakefile: Extract custom command validation method
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 564ac56..6462c26 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -821,6 +821,22 @@ void cmMakefile::ConfigureFinalPass()
}
}
+bool cmMakefile::ValidateCustomCommand(
+ const cmCustomCommandLines& commandLines) const
+{
+ // TODO: More strict?
+ for (cmCustomCommandLine const& cl : commandLines) {
+ if (!cl.empty() && !cl[0].empty() && cl[0][0] == '"') {
+ std::ostringstream e;
+ e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n";
+ this->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ return false;
+ }
+ }
+
+ return true;
+}
+
void cmMakefile::AddCustomCommandToTarget(
const std::string& target, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
@@ -959,14 +975,9 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
return nullptr;
}
- // Validate custom commands. TODO: More strict?
- for (cmCustomCommandLine const& cl : commandLines) {
- if (!cl.empty() && !cl[0].empty() && cl[0][0] == '"') {
- std::ostringstream e;
- e << "COMMAND may not contain literal quotes:\n " << cl[0] << "\n";
- this->IssueMessage(MessageType::FATAL_ERROR, e.str());
- return nullptr;
- }
+ // Validate custom commands.
+ if (!this->ValidateCustomCommand(commandLines)) {
+ return nullptr;
}
// Always create the output sources and mark them generated.