summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2019-01-29 02:06:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-30 15:47:24 (GMT)
commit198650ae7399cc086c49e58b0a9e03e9efb86235 (patch)
treea0e27ca7fe9bd39fac7545a299f16141016c4d80 /Source/cmState.cxx
parentd75fec5a88f81a8c16cdeab46766e92a14d1d3cf (diff)
downloadCMake-198650ae7399cc086c49e58b0a9e03e9efb86235.zip
CMake-198650ae7399cc086c49e58b0a9e03e9efb86235.tar.gz
CMake-198650ae7399cc086c49e58b0a9e03e9efb86235.tar.bz2
set: warn if CACHE type is not recognized
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index fdd7b3d..a08e9b8 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -75,14 +75,23 @@ const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type)
cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s)
{
+ cmStateEnums::CacheEntryType type = cmStateEnums::STRING;
+ StringToCacheEntryType(s, type);
+ return type;
+}
+
+bool cmState::StringToCacheEntryType(const char* s,
+ cmStateEnums::CacheEntryType& type)
+{
int i = 0;
while (cmCacheEntryTypes[i]) {
if (strcmp(s, cmCacheEntryTypes[i]) == 0) {
- return static_cast<cmStateEnums::CacheEntryType>(i);
+ type = static_cast<cmStateEnums::CacheEntryType>(i);
+ return true;
}
++i;
}
- return cmStateEnums::STRING;
+ return false;
}
bool cmState::IsCacheEntryType(std::string const& key)