mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
cmLocalGenerator: Re-order logic in CreateGeneratedSource
Return early on errors to reduce nesting.
This commit is contained in:
@@ -3816,18 +3816,19 @@ void CreateGeneratedSource(cmLocalGenerator& lg, const std::string& output,
|
|||||||
cmCommandOrigin origin,
|
cmCommandOrigin origin,
|
||||||
const cmListFileBacktrace& lfbt)
|
const cmListFileBacktrace& lfbt)
|
||||||
{
|
{
|
||||||
if (cmGeneratorExpression::Find(output) == std::string::npos) {
|
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 {
|
|
||||||
lg.GetCMakeInstance()->IssueMessage(
|
lg.GetCMakeInstance()->IssueMessage(
|
||||||
MessageType::FATAL_ERROR,
|
MessageType::FATAL_ERROR,
|
||||||
"Generator expressions in custom command outputs are not implemented!",
|
"Generator expressions in custom command outputs are not implemented!",
|
||||||
lfbt);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user