summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2017-05-10 19:05:29 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2017-05-11 17:49:06 (GMT)
commit587084052bbecc812de00e75aac389faef6b7eed (patch)
treee11a66bceaac026ae0e840e8fcb40b5541da5b51 /Source/cmState.cxx
parenta890ca2f8dfc640f7096f3ad89a2429315d8b71a (diff)
downloadCMake-587084052bbecc812de00e75aac389faef6b7eed.zip
CMake-587084052bbecc812de00e75aac389faef6b7eed.tar.gz
CMake-587084052bbecc812de00e75aac389faef6b7eed.tar.bz2
cmState: introduce methods for adding builtin commands
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 43f439c..510501b 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -12,10 +12,12 @@
#include "cmCacheManager.h"
#include "cmCommand.h"
#include "cmDefinitions.h"
+#include "cmDisallowedCommand.h"
#include "cmListFileCache.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
+#include "cmUnexpectedCommand.h"
#include "cmake.h"
cmState::cmState()
@@ -410,6 +412,27 @@ void cmState::AddCommand(cmCommand* command)
this->Commands.insert(std::make_pair(name, command));
}
+void cmState::AddBuiltinCommand(std::string const& name, cmCommand* command)
+{
+ assert(name == cmSystemTools::LowerCase(name));
+ assert(name == cmSystemTools::LowerCase(command->GetName()));
+ assert(this->Commands.find(name) == this->Commands.end());
+ this->Commands.insert(std::make_pair(name, command));
+}
+
+void cmState::AddDisallowedCommand(std::string const& name, cmCommand* command,
+ cmPolicies::PolicyID policy,
+ const char* message)
+{
+ this->AddBuiltinCommand(name,
+ new cmDisallowedCommand(command, policy, message));
+}
+
+void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
+{
+ this->AddBuiltinCommand(name, new cmUnexpectedCommand(name, error));
+}
+
cmCommand* cmState::GetCommand(std::string const& name) const
{
cmCommand* command = CM_NULLPTR;