summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-25 14:37:04 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-25 14:37:04 (GMT)
commit5f4686920d3615187c53f3064eb7f1345b2203b2 (patch)
tree58c0329ff54765ffbe6c02d8234620650114292e /Source/cmCommandArgumentParserHelper.cxx
parent5efdefbc27b486c43dabf5dc1549bd12beb52a12 (diff)
downloadCMake-5f4686920d3615187c53f3064eb7f1345b2203b2.zip
CMake-5f4686920d3615187c53f3064eb7f1345b2203b2.tar.gz
CMake-5f4686920d3615187c53f3064eb7f1345b2203b2.tar.bz2
BUG: Fix CMAKE_CURRENT_LIST_FILE in macros
The value of CMAKE_CURRENT_LIST_FILE is supposed to be the list file currently being executed. Before macros were introduced this was always the context of the argument referencing the variable. Our original implementation of macros replaced the context of command arguments inside the macro with that of the arguments of the calling context. This worked recursively, but only worked when macros had at least one argument. Furthermore, it caused parsing errors of the arguments to report the wrong location (calling context instead of line with error). The commit "Improve context for errors in macros" fixed the latter bug by keeping the lexical context of command arguments in macros. It broke evaluation of CMAKE_CURRENT_LIST_FILE because the calling context was no longer preserved in the argument referencing the variable. However, since our list file processing now maintains the proper value of CMAKE_CURRENT_LIST_FILE with dynamic scope we no longer need the context of the argument and can just evaluate the variable normally.
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx6
1 files changed, 1 insertions, 5 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index c67f884..4eec953 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -115,11 +115,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
{
return 0;
}
- if(this->FileName && strcmp(var, "CMAKE_CURRENT_LIST_FILE") == 0)
- {
- return this->AddString(this->FileName);
- }
- else if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0)
+ if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0)
{
cmOStringStream ostr;
ostr << this->FileLine;