summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCacheManager.cxx17
-rw-r--r--Source/cmCacheManager.h4
-rw-r--r--Source/cmLoadCacheCommand.cxx38
-rw-r--r--Source/cmLoadCacheCommand.h1
-rw-r--r--Source/cmake.cxx3
5 files changed, 14 insertions, 49 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 2aa6236..2baacbf 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -93,14 +93,14 @@ bool cmCacheManager::LoadCache(const char* path,
return this->LoadCache(path, internal, emptySet, emptySet);
}
-bool cmCacheManager::ParseEntry(const char* entry,
- std::string& var,
- std::string& value)
+static bool ParseEntryWithoutType(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;
@@ -169,6 +169,11 @@ bool cmCacheManager::ParseEntry(const char* entry,
value.size() - 2);
}
+ if (!flag)
+ {
+ return ParseEntryWithoutType(entry, var, value);
+ }
+
return flag;
}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index da14966..314017b 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -139,10 +139,6 @@ public:
std::string& value,
CacheEntryType& type);
- static bool ParseEntry(const char* entry,
- std::string& var,
- std::string& value);
-
///! Get a value from the cache given a key
const char* GetCacheValue(const char* key) const;
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index d2a07dc..a239e55 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -174,7 +174,8 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// Check one line of the cache file.
std::string var;
std::string value;
- if(this->ParseEntry(line, var, value))
+ cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+ if(cmCacheManager::ParseEntry(line, var, value, type))
{
// Found a real entry. See if this one was requested.
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
@@ -193,38 +194,3 @@ void cmLoadCacheCommand::CheckLine(const char* line)
}
}
}
-
-//----------------------------------------------------------------------------
-bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var,
- std::string& value)
-{
- // input line is: key:type=value
- cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- // input line is: "key":type=value
- cmsys::RegularExpression
- regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- bool flag = false;
- if(regQuoted.find(entry))
- {
- var = regQuoted.match(1);
- value = regQuoted.match(3);
- flag = true;
- }
- else if (reg.find(entry))
- {
- var = reg.match(1);
- value = reg.match(3);
- flag = true;
- }
-
- // if value is enclosed in single quotes ('foo') then remove them
- // it is used to enclose trailing space or tab
- if (flag &&
- value.size() >= 2 &&
- value[0] == '\'' &&
- value[value.size() - 1] == '\'')
- {
- value = value.substr(1, value.size() - 2);
- }
- return flag;
-}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index b06d94d..8ecee4a 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -83,7 +83,6 @@ protected:
bool ReadWithPrefix(std::vector<std::string> const& args);
void CheckLine(const char* line);
- bool ParseEntry(const char* entry, std::string& var, std::string& value);
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index aec8e06..ddfdc24 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -363,8 +363,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
std::string var, value;
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
- if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) ||
- cmCacheManager::ParseEntry(entry.c_str(), var, value))
+ if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type))
{
this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
"No help, variable specified on the command line.", type);