summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-21 17:51:35 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-29 21:12:33 (GMT)
commite8b0359a4318bb682c96e527de7ed7f5be02c38f (patch)
tree5ea4137b78124e4619bb4aff1856a04b729f93fd /Source/cmCommandArgumentParserHelper.cxx
parent98805494055f8fb4afc2da9f96a487987333981a (diff)
downloadCMake-e8b0359a4318bb682c96e527de7ed7f5be02c38f.zip
CMake-e8b0359a4318bb682c96e527de7ed7f5be02c38f.tar.gz
CMake-e8b0359a4318bb682c96e527de7ed7f5be02c38f.tar.bz2
cmake_language: Add signature to DEFER calls to later times
Fixes: #19575
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index e3d014e..d4f5022 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -8,8 +8,11 @@
#include <utility>
#include <cm/memory>
+#include <cm/optional>
+#include <cmext/string_view>
#include "cmCommandArgumentLexer.h"
+#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
@@ -91,7 +94,14 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
return nullptr;
}
if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
- return this->AddString(std::to_string(this->FileLine));
+ std::string line;
+ cmListFileContext const& top = this->Makefile->GetBacktrace().Top();
+ if (top.DeferId) {
+ line = cmStrCat("DEFERRED:"_s, *top.DeferId);
+ } else {
+ line = std::to_string(this->FileLine);
+ }
+ return this->AddString(line);
}
cmProp value = this->Makefile->GetDefinition(var);
if (!value) {