summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-19 19:06:39 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-10 12:06:20 (GMT)
commite4034eabe930fb677fb9b5c65cf29336d1ff123c (patch)
treefb6b72178c2e2df3d7e81bbe5057d50d4cd8117e
parent706c48301d29124e2ec4cd554b0de86d3743d62d (diff)
downloadCMake-e4034eabe930fb677fb9b5c65cf29336d1ff123c.zip
CMake-e4034eabe930fb677fb9b5c65cf29336d1ff123c.tar.gz
CMake-e4034eabe930fb677fb9b5c65cf29336d1ff123c.tar.bz2
cmLocalGenerator: Re-order logic in CreateGeneratedSource
Return early on errors to reduce nesting.
-rw-r--r--Source/cmLocalGenerator.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c9dfdea..5739c03 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3816,18 +3816,19 @@ void CreateGeneratedSource(cmLocalGenerator& lg, const std::string& output,
cmCommandOrigin origin,
const cmListFileBacktrace& lfbt)
{
- if (cmGeneratorExpression::Find(output) == std::string::npos) {
- // Outputs without generator expressions from the project are already
- // created and marked as generated. Do not mark them again, because
- // other commands might have overwritten the property.
- if (origin == cmCommandOrigin::Generator) {
- lg.GetMakefile()->GetOrCreateGeneratedSource(output);
- }
- } else {
+ if (cmGeneratorExpression::Find(output) != std::string::npos) {
lg.GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"Generator expressions in custom command outputs are not implemented!",
lfbt);
+ return;
+ }
+
+ // Outputs without generator expressions from the project are already
+ // created and marked as generated. Do not mark them again, because
+ // other commands might have overwritten the property.
+ if (origin == cmCommandOrigin::Generator) {
+ lg.GetMakefile()->GetOrCreateGeneratedSource(output);
}
}