Merge topic 'add_custom_command-target-alias'

3b07ec631d add_custom_command: Allow adding build event via ALIAS target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9201
This commit is contained in:
Brad King
2024-02-01 13:32:11 +00:00
committed by Kitware Robot
4 changed files with 19 additions and 3 deletions
+8 -2
View File
@@ -1144,9 +1144,15 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
const std::string& target, cmObjectLibraryCommands objLibCommands,
const cmListFileBacktrace& lfbt) const
{
// Find the target to which to add the custom command.
auto ti = this->Targets.find(target);
auto realTarget = target;
auto ai = this->AliasTargets.find(target);
if (ai != this->AliasTargets.end()) {
realTarget = ai->second;
}
// Find the target to which to add the custom command.
auto ti = this->Targets.find(realTarget);
if (ti == this->Targets.end()) {
MessageType messageType = MessageType::AUTHOR_WARNING;
bool issueMessage = false;