summaryrefslogtreecommitdiffstats
path: root/Source/cmSetCommand.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/cmSetCommand.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/cmSetCommand.cxx')
-rw-r--r--Source/cmSetCommand.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 1a2d1c6..b09e3ca 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -4,6 +4,7 @@
#include "cmAlgorithms.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
@@ -112,7 +113,15 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args,
if (cache) {
std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0);
- type = cmState::StringToCacheEntryType(args[cacheStart + 1].c_str());
+ if (!cmState::StringToCacheEntryType(args[cacheStart + 1].c_str(), type)) {
+ std::string m = "implicitly converting '" + args[cacheStart + 1] +
+ "' to 'STRING' type.";
+ this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m);
+ // Setting this may not be required, since it's
+ // initialized as a string. Keeping this here to
+ // ensure that the type is actually converting to a string.
+ type = cmStateEnums::STRING;
+ }
docstring = args[cacheStart + 2].c_str();
}