diff options
author | Brad King <brad.king@kitware.com> | 2006-10-04 18:37:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-10-04 18:37:42 (GMT) |
commit | 523075ded543cbb7044bc4b56203d329aff0cb42 (patch) | |
tree | b437035f021967f257018e4199291c5f0983aabf | |
parent | 430f6f35ebfd237e6f33afee21308bfc28a7a553 (diff) | |
download | CMake-523075ded543cbb7044bc4b56203d329aff0cb42.zip CMake-523075ded543cbb7044bc4b56203d329aff0cb42.tar.gz CMake-523075ded543cbb7044bc4b56203d329aff0cb42.tar.bz2 |
BUG: Do not replace @VAR@ syntax in list files. This addresses bug #2722.
-rw-r--r-- | Source/cmCommandArgumentParser.cxx | 2 | ||||
-rw-r--r-- | Source/cmCommandArgumentParser.y | 2 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 16 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.h | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 7 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 | ||||
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 4 |
7 files changed, 30 insertions, 7 deletions
diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index d7b8df9..a95ac23 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -1320,7 +1320,7 @@ yyreduce: case 17: #line 178 "cmCommandArgumentParser.y" { - (yyval.str) = yyGetParser->ExpandVariable((yyvsp[0].str)); + (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); } break; diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index 5b10234..8f03a4b 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -193,7 +193,7 @@ cal_DCURLY MultipleIds cal_RCURLY | cal_ATNAME { - $<str>$ = yyGetParser->ExpandVariable($<str>1); + $<str>$ = yyGetParser->ExpandVariableForAt($<str>1); } MultipleIds: diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 4b08734..d446e15 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -37,6 +37,7 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper() strcpy(this->BSLASHVariable, "\\"); this->NoEscapeMode = false; + this->ReplaceAtSyntax = false; } @@ -115,6 +116,21 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) return this->AddString(value); } +char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) +{ + if(this->ReplaceAtSyntax) + { + return this->ExpandVariable(var); + } + else + { + std::string ref = "@"; + ref += var; + ref += "@"; + return this->AddString(ref.c_str()); + } +} + char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2) { if ( !in1 ) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index cb64393..7f5078f 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -59,6 +59,7 @@ public: char* ExpandSpecialVariable(const char* key, const char* var); char* ExpandVariable(const char* var); + char* ExpandVariableForAt(const char* var); void SetResult(const char* value); void SetMakefile(const cmMakefile* mf); @@ -68,6 +69,7 @@ public: void SetLineFile(long line, const char* file); void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; } void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; } + void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; } const char* GetError() { return this->ErrorString.c_str(); } char EmptyVariable[1]; @@ -101,6 +103,7 @@ private: bool EscapeQuotes; std::string ErrorString; bool NoEscapeMode; + bool ReplaceAtSyntax; }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 29c3bde..52a9127 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1662,7 +1662,8 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, bool atOnly, const char* filename, long line, - bool removeEmpty) const + bool removeEmpty, + bool replaceAt) const { if ( source.empty() || source.find_first_of("$@\\") == source.npos) { @@ -1681,6 +1682,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, parser.SetLineFile(line, filename); parser.SetEscapeQuotes(escapeQuotes); parser.SetNoEscapeMode(noEscapes); + parser.SetReplaceAtSyntax(replaceAt); int res = parser.ParseString(source.c_str(), 0); if ( res ) { @@ -2022,7 +2024,8 @@ void cmMakefile::ExpandArguments( // Expand the variables in the argument. value = i->Value; this->ExpandVariablesInString(value, false, false, false, - i->FilePath, i->Line); + i->FilePath, i->Line, + false, false); // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5f3ff61..094fee9 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -570,7 +570,8 @@ public: bool atOnly = false, const char* filename = 0, long line = -1, - bool removeEmpty = false) const; + bool removeEmpty = false, + bool replaceAt = true) const; /** * Remove any remaining variables in the string. Anything with ${var} or diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 5d13702..0d4b78c 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -185,7 +185,7 @@ SET(CHECK_ARGS dollar$sign &ersands& amper&sand - \@two-ats\@ + @two-ats@ one@at "c:/posix/path/with space" "c:\\windows\\path\\with space" @@ -204,7 +204,7 @@ SET(CHECK_ARGS "dollar$sign with space" "&ersands& with space" "amper&sand with space" - "\@two-ats\@ with space" + "@two-ats@ with space" "one@at with space" ) FOREACH(arg ${CHECK_ARGS}) |