diff options
author | Brad King <brad.king@kitware.com> | 2008-09-25 14:21:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-09-25 14:21:15 (GMT) |
commit | f8bc0492e174c2787780ec04979e8ca7e50d5aad (patch) | |
tree | fbad0890ee3d7196b106c1049b39c273d5cbb8db /Source | |
parent | 883d8e186c06e4fdf4e9dd6ccce985a89d5b8d46 (diff) | |
download | CMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.zip CMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.tar.gz CMake-f8bc0492e174c2787780ec04979e8ca7e50d5aad.tar.bz2 |
ENH: Create $CACHE{VAR} syntax
This syntax allows reading of cache entries even when variables of the
same name have been defined in the local scope. See issue #7715.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 2aa6c0c..c67f884 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -87,9 +87,24 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } return this->EmptyVariable; } + if ( strcmp(key, "CACHE") == 0 ) + { + if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var)) + { + if(this->EscapeQuotes) + { + return this->AddString(cmSystemTools::EscapeQuotes(c).c_str()); + } + else + { + return this->AddString(c); + } + } + return this->EmptyVariable; + } cmOStringStream e; e << "Syntax $" << key << "{} is not supported. " - << "Only ${} and ENV{} are allowed."; + << "Only ${}, $ENV{}, and $CACHE{} are allowed."; this->SetError(e.str()); return 0; } |