Fix parsing of cache variables without a type

These mainly come from the command line or manual entries in the
CMakeCache.txt file. We want to stop at the first '=' because this is
what is most likely to have been meant. The variable can be quoted if
the '=' is intended.

Caveat: What if one wants both '"' and '=' in a variable name?
This commit is contained in:
Ben Boeckel 2010-11-22 14:56:55 -05:00
parent 40b9336b31
commit 6fe8624b7f
1 changed files with 3 additions and 3 deletions

View File

@ -97,10 +97,10 @@ bool cmCacheManager::ParseEntry(const char* entry,
std::string& var,
std::string& value)
{
// input line is: key:type=value
// input line is: key=value
static cmsys::RegularExpression reg(
"^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
// input line is: "key":type=value
"^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
// input line is: "key"=value
static cmsys::RegularExpression regQuoted(
"^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
bool flag = false;