summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorChen Linxuan <me@black-desk.cn>2024-01-30 06:11:32 (GMT)
committerBrad King <brad.king@kitware.com>2024-02-01 13:21:41 (GMT)
commit3b07ec631db67e2e44d9f39fb7727a2dafd07b6a (patch)
tree0916dfe0b4ec4711ecf47a67ae69b47ce8c9588f /Source
parent3cd2c59ecf7104d0b3d6bf5609bf96959bdcdfb0 (diff)
downloadCMake-3b07ec631db67e2e44d9f39fb7727a2dafd07b6a.zip
CMake-3b07ec631db67e2e44d9f39fb7727a2dafd07b6a.tar.gz
CMake-3b07ec631db67e2e44d9f39fb7727a2dafd07b6a.tar.bz2
add_custom_command: Allow adding build event via ALIAS target
Signed-off-by: Chen Linxuan <me@black-desk.cn>
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2687afa..509f28b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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;