summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-12 13:13:48 +0000
committerKitware Robot <kwrobot@kitware.com>2017-05-12 09:13:51 -0400
commit836cb52e9aec83f88841cb5b45abb1d32bb02214 (patch)
tree7c8abd2596179f3e7de96a92c0be095dbab2e008
parent793b223c02bfbb9d5bd03194a7f9748f6cecf2f2 (diff)
parenta1218f59d9164407c6e28f816b0f11314b64fe5c (diff)
downloadcmake-836cb52e9aec83f88841cb5b45abb1d32bb02214.tar.gz
Merge topic 'command-name'
a1218f59 cmCommand: remove unused methods from interface and all implementations 4ba25a82 cmState: separate builtin and scripted commands a44dab46 cmState: introduce method for adding scripted commands c734c850 CTest: use new methods for builtin commands bd14e464 cmCommands: use new methods for builtin commands 58708405 cmState: introduce methods for adding builtin commands a890ca2f cmakemain: use script role for -P Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !829
-rw-r--r--Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h8
-rw-r--r--Source/CTest/cmCTestHandlerCommand.h5
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.cxx1
-rw-r--r--Source/CTest/cmCTestMemCheckCommand.h7
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.h5
-rw-r--r--Source/CTest/cmCTestRunScriptCommand.h5
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx41
-rw-r--r--Source/CTest/cmCTestScriptHandler.h2
-rw-r--r--Source/CTest/cmCTestSleepCommand.h5
-rw-r--r--Source/CTest/cmCTestStartCommand.h5
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx30
-rw-r--r--Source/cmAddCompileOptionsCommand.h5
-rw-r--r--Source/cmAddCustomCommandCommand.h5
-rw-r--r--Source/cmAddCustomTargetCommand.h5
-rw-r--r--Source/cmAddDefinitionsCommand.h5
-rw-r--r--Source/cmAddDependenciesCommand.h5
-rw-r--r--Source/cmAddExecutableCommand.h5
-rw-r--r--Source/cmAddLibraryCommand.h5
-rw-r--r--Source/cmAddSubDirectoryCommand.h5
-rw-r--r--Source/cmAddTestCommand.h5
-rw-r--r--Source/cmAuxSourceDirectoryCommand.h5
-rw-r--r--Source/cmBreakCommand.h5
-rw-r--r--Source/cmBuildCommand.h5
-rw-r--r--Source/cmBuildNameCommand.h1
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h8
-rw-r--r--Source/cmCMakeMinimumRequired.h5
-rw-r--r--Source/cmCMakePolicyCommand.h5
-rw-r--r--Source/cmCommand.h11
-rw-r--r--Source/cmCommands.cxx288
-rw-r--r--Source/cmConfigureFileCommand.h5
-rw-r--r--Source/cmContinueCommand.h5
-rw-r--r--Source/cmCreateTestSourceList.h5
-rw-r--r--Source/cmDefinePropertyCommand.h5
-rw-r--r--Source/cmDisallowedCommand.h2
-rw-r--r--Source/cmEnableLanguageCommand.h5
-rw-r--r--Source/cmEnableTestingCommand.h5
-rw-r--r--Source/cmExecProgramCommand.h5
-rw-r--r--Source/cmExecuteProcessCommand.h5
-rw-r--r--Source/cmExportCommand.h5
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h4
-rw-r--r--Source/cmFLTKWrapUICommand.h5
-rw-r--r--Source/cmFileCommand.h5
-rw-r--r--Source/cmFindFileCommand.h3
-rw-r--r--Source/cmFindLibraryCommand.h5
-rw-r--r--Source/cmFindPackageCommand.h5
-rw-r--r--Source/cmFindPathCommand.h5
-rw-r--r--Source/cmFindProgramCommand.h5
-rw-r--r--Source/cmForEachCommand.h5
-rw-r--r--Source/cmFunctionCommand.cxx16
-rw-r--r--Source/cmFunctionCommand.h5
-rw-r--r--Source/cmGetCMakePropertyCommand.h5
-rw-r--r--Source/cmGetDirectoryPropertyCommand.h5
-rw-r--r--Source/cmGetFilenameComponentCommand.h5
-rw-r--r--Source/cmGetPropertyCommand.h5
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h8
-rw-r--r--Source/cmGetTargetPropertyCommand.h5
-rw-r--r--Source/cmGetTestPropertyCommand.h5
-rw-r--r--Source/cmIfCommand.h5
-rw-r--r--Source/cmIncludeCommand.h5
-rw-r--r--Source/cmIncludeDirectoryCommand.h5
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h8
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h8
-rw-r--r--Source/cmInstallCommand.h5
-rw-r--r--Source/cmInstallFilesCommand.h5
-rw-r--r--Source/cmInstallProgramsCommand.h5
-rw-r--r--Source/cmInstallTargetsCommand.h5
-rw-r--r--Source/cmLinkDirectoriesCommand.h5
-rw-r--r--Source/cmLinkLibrariesCommand.h5
-rw-r--r--Source/cmListCommand.h5
-rw-r--r--Source/cmLoadCacheCommand.h5
-rw-r--r--Source/cmLoadCommandCommand.cxx7
-rw-r--r--Source/cmLoadCommandCommand.h1
-rw-r--r--Source/cmMacroCommand.cxx15
-rw-r--r--Source/cmMacroCommand.h5
-rw-r--r--Source/cmMakeDirectoryCommand.h5
-rw-r--r--Source/cmMarkAsAdvancedCommand.h5
-rw-r--r--Source/cmMathCommand.h5
-rw-r--r--Source/cmMessageCommand.h5
-rw-r--r--Source/cmOptionCommand.h5
-rw-r--r--Source/cmOutputRequiredFilesCommand.h1
-rw-r--r--Source/cmParseArgumentsCommand.h5
-rw-r--r--Source/cmProjectCommand.h5
-rw-r--r--Source/cmQTWrapCPPCommand.h5
-rw-r--r--Source/cmQTWrapUICommand.h5
-rw-r--r--Source/cmRemoveCommand.h5
-rw-r--r--Source/cmRemoveDefinitionsCommand.h5
-rw-r--r--Source/cmReturnCommand.h5
-rw-r--r--Source/cmSeparateArgumentsCommand.h5
-rw-r--r--Source/cmSetCommand.h5
-rw-r--r--Source/cmSetDirectoryPropertiesCommand.h8
-rw-r--r--Source/cmSetPropertyCommand.h5
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h8
-rw-r--r--Source/cmSetTargetPropertiesCommand.h5
-rw-r--r--Source/cmSetTestsPropertiesCommand.h5
-rw-r--r--Source/cmSiteNameCommand.h5
-rw-r--r--Source/cmSourceGroupCommand.h5
-rw-r--r--Source/cmState.cxx117
-rw-r--r--Source/cmState.h11
-rw-r--r--Source/cmStringCommand.h5
-rw-r--r--Source/cmSubdirCommand.h5
-rw-r--r--Source/cmSubdirDependsCommand.h1
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h8
-rw-r--r--Source/cmTargetCompileFeaturesCommand.h2
-rw-r--r--Source/cmTargetCompileOptionsCommand.h5
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h8
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h5
-rw-r--r--Source/cmTargetSourcesCommand.h5
-rw-r--r--Source/cmTryCompileCommand.h5
-rw-r--r--Source/cmTryRunCommand.h5
-rw-r--r--Source/cmUnexpectedCommand.h2
-rw-r--r--Source/cmUnsetCommand.h5
-rw-r--r--Source/cmUseMangledMesaCommand.h2
-rw-r--r--Source/cmUtilitySourceCommand.h1
-rw-r--r--Source/cmVariableRequiresCommand.h1
-rw-r--r--Source/cmVariableWatchCommand.h5
-rw-r--r--Source/cmWhileCommand.h5
-rw-r--r--Source/cmWriteFileCommand.h5
-rw-r--r--Source/cmakemain.cxx4
-rwxr-xr-xbootstrap1
119 files changed, 268 insertions, 796 deletions
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
index bfd4061255..503ed234d5 100644
--- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
+++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
@@ -42,14 +42,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "ctest_empty_binary_directory";
- }
};
#endif
diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h
index adc1687ed9..0ea0612253 100644
--- a/Source/CTest/cmCTestHandlerCommand.h
+++ b/Source/CTest/cmCTestHandlerCommand.h
@@ -25,6 +25,11 @@ public:
cmCTestHandlerCommand();
/**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual std::string GetName() const = 0;
+
+ /**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index fd7c3a9a56..b9cae3bfe6 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -3,6 +3,7 @@
#include "cmCTestMemCheckCommand.h"
#include <sstream>
+#include <string>
#include <vector>
#include "cmCTest.h"
diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h
index fea65e8b66..fa595594a9 100644
--- a/Source/CTest/cmCTestMemCheckCommand.h
+++ b/Source/CTest/cmCTestMemCheckCommand.h
@@ -7,8 +7,6 @@
#include "cmCTestTestCommand.h"
-#include <string>
-
class cmCTestGenericHandler;
class cmCommand;
@@ -33,11 +31,6 @@ public:
return ni;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_memcheck"; }
-
protected:
cmCTestGenericHandler* InitializeActualHandler() CM_OVERRIDE;
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h
index 04024abc16..5989fa0fc0 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.h
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.h
@@ -40,11 +40,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_read_custom_files"; }
};
#endif
diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h
index aac5114f0f..9bd09659d1 100644
--- a/Source/CTest/cmCTestRunScriptCommand.h
+++ b/Source/CTest/cmCTestRunScriptCommand.h
@@ -41,11 +41,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_run_script"; }
};
#endif
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 1fea8e575f..1d29dfac27 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -166,12 +166,12 @@ void cmCTestScriptHandler::UpdateElapsedTime()
}
}
-void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
+void cmCTestScriptHandler::AddCTestCommand(std::string const& name,
+ cmCTestCommand* command)
{
- cmCTestCommand* newCom = command;
- newCom->CTest = this->CTest;
- newCom->CTestScriptHandler = this;
- this->CMake->GetState()->AddCommand(newCom);
+ command->CTest = this->CTest;
+ command->CTestScriptHandler = this;
+ this->CMake->GetState()->AddBuiltinCommand(name, command);
}
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
@@ -290,22 +290,21 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
- // add any ctest specific commands, probably should have common superclass
- // for ctest commands to clean this up. If a couple more commands are
- // created with the same format lets do that - ken
- this->AddCTestCommand(new cmCTestBuildCommand);
- this->AddCTestCommand(new cmCTestConfigureCommand);
- this->AddCTestCommand(new cmCTestCoverageCommand);
- this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
- this->AddCTestCommand(new cmCTestMemCheckCommand);
- this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
- this->AddCTestCommand(new cmCTestRunScriptCommand);
- this->AddCTestCommand(new cmCTestSleepCommand);
- this->AddCTestCommand(new cmCTestStartCommand);
- this->AddCTestCommand(new cmCTestSubmitCommand);
- this->AddCTestCommand(new cmCTestTestCommand);
- this->AddCTestCommand(new cmCTestUpdateCommand);
- this->AddCTestCommand(new cmCTestUploadCommand);
+ this->AddCTestCommand("ctest_build", new cmCTestBuildCommand);
+ this->AddCTestCommand("ctest_configure", new cmCTestConfigureCommand);
+ this->AddCTestCommand("ctest_coverage", new cmCTestCoverageCommand);
+ this->AddCTestCommand("ctest_empty_binary_directory",
+ new cmCTestEmptyBinaryDirectoryCommand);
+ this->AddCTestCommand("ctest_memcheck", new cmCTestMemCheckCommand);
+ this->AddCTestCommand("ctest_read_custom_files",
+ new cmCTestReadCustomFilesCommand);
+ this->AddCTestCommand("ctest_run_script", new cmCTestRunScriptCommand);
+ this->AddCTestCommand("ctest_sleep", new cmCTestSleepCommand);
+ this->AddCTestCommand("ctest_start", new cmCTestStartCommand);
+ this->AddCTestCommand("ctest_submit", new cmCTestSubmitCommand);
+ this->AddCTestCommand("ctest_test", new cmCTestTestCommand);
+ this->AddCTestCommand("ctest_update", new cmCTestUpdateCommand);
+ this->AddCTestCommand("ctest_upload", new cmCTestUploadCommand);
}
// this sets up some variables for the script to use, creates the required
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 30707962d5..6678702605 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -126,7 +126,7 @@ private:
int RunConfigurationDashboard();
// Add ctest command
- void AddCTestCommand(cmCTestCommand* command);
+ void AddCTestCommand(std::string const& name, cmCTestCommand* command);
// Try to remove the binary directory once
static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath);
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index a55e9d9a7e..f0b5f1eeb2 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -41,11 +41,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_sleep"; }
};
#endif
diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h
index 26a63fba06..b4943f92d8 100644
--- a/Source/CTest/cmCTestStartCommand.h
+++ b/Source/CTest/cmCTestStartCommand.h
@@ -54,11 +54,6 @@ public:
*/
bool ShouldBeQuiet() { return this->Quiet; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "ctest_start"; }
-
private:
bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
bool CreateNewTag;
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 349e91a851..da3ae2f866 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -56,11 +56,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "subdirs"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -136,11 +131,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -206,11 +196,6 @@ public:
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_test"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -244,11 +229,6 @@ public:
bool InitialPass(std::vector<std::string> const& /*args*/,
cmExecutionStatus& /*unused*/) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
-
cmCTestTestHandler* TestHandler;
};
@@ -1662,23 +1642,23 @@ void cmCTestTestHandler::GetListOfTests()
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
newCom1->TestHandler = this;
- cm.GetState()->AddCommand(newCom1);
+ cm.GetState()->AddBuiltinCommand("add_test", newCom1);
// Add handler for SUBDIRS
cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
newCom2->TestHandler = this;
- cm.GetState()->AddCommand(newCom2);
+ cm.GetState()->AddBuiltinCommand("subdirs", newCom2);
// Add handler for ADD_SUBDIRECTORY
cmCTestAddSubdirectoryCommand* newCom3 = new cmCTestAddSubdirectoryCommand;
newCom3->TestHandler = this;
- cm.GetState()->AddCommand(newCom3);
+ cm.GetState()->AddBuiltinCommand("add_subdirectory", newCom3);
- // Add handler for SET_SOURCE_FILES_PROPERTIES
+ // Add handler for SET_TESTS_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom4 =
new cmCTestSetTestsPropertiesCommand;
newCom4->TestHandler = this;
- cm.GetState()->AddCommand(newCom4);
+ cm.GetState()->AddBuiltinCommand("set_tests_properties", newCom4);
const char* testFilename;
if (cmSystemTools::FileExists("CTestTestfile.cmake")) {
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 105d323100..297f901db4 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -26,11 +26,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_compile_options"; }
};
#endif
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 912a91a4f4..c3a91b2a35 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_custom_command"; }
-
protected:
bool CheckOutputs(const std::vector<std::string>& outputs);
};
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index c449b10483..7229c27795 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_custom_target"; }
};
#endif
diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h
index de4bc1cd95..abf5a5964a 100644
--- a/Source/cmAddDefinitionsCommand.h
+++ b/Source/cmAddDefinitionsCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_definitions"; }
};
#endif
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 88ac33637e..c7328d63e9 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_dependencies"; }
};
#endif
diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h
index 6531829a75..8100da1852 100644
--- a/Source/cmAddExecutableCommand.h
+++ b/Source/cmAddExecutableCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_executable"; }
};
#endif
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 977645ef18..df49fae937 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_library"; }
};
#endif
diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h
index b19477a459..0e71ffd857 100644
--- a/Source/cmAddSubDirectoryCommand.h
+++ b/Source/cmAddSubDirectoryCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_subdirectory"; }
};
#endif
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 1d6c4cc9d5..a098a03f1d 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -32,11 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "add_test"; }
-
private:
bool HandleNameMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h
index f8800a5c86..e49e86117b 100644
--- a/Source/cmAuxSourceDirectoryCommand.h
+++ b/Source/cmAuxSourceDirectoryCommand.h
@@ -35,11 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "aux_source_directory"; }
};
#endif
diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 0038883e91..fcca45c316 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "break"; }
};
#endif
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index 7df54ec3d5..1f357a980f 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -42,11 +42,6 @@ public:
*/
virtual bool TwoArgsSignature(std::vector<std::string> const& args);
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "build_command"; }
-
private:
bool IgnoreErrors() const;
};
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 9008c27f2c..ff26c559c4 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmBuildNameCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "build_name"; }
};
#endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index 4263e75670..ef6ca37303 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -40,14 +40,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "cmake_host_system_information";
- }
-
private:
bool GetValue(cmsys::SystemInformation& info, std::string const& key,
std::string& value);
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index d264675ac1..45b6b78850 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -32,11 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
-
private:
std::vector<std::string> UnknownArguments;
bool EnforceUnknownArguments();
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index cc021691f6..0e88243f56 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
-
private:
bool HandleSetMode(std::vector<std::string> const& args);
bool HandleGetMode(std::vector<std::string> const& args);
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 2e2ba433e1..ad72fe2086 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -80,17 +80,6 @@ public:
virtual cmCommand* Clone() = 0;
/**
- * This determines if the command is defined in a cmake script.
- * It is the case for cmMacroHelperCommand and cmFunctionHelperCommand.
- */
- virtual bool IsUserDefined() const { return false; }
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- virtual std::string GetName() const = 0;
-
- /**
* Return the last error string.
*/
const char* GetError();
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index adf46ffa3c..e1d8ef1434 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -70,7 +70,6 @@
#include "cmTargetLinkLibrariesCommand.h"
#include "cmTryCompileCommand.h"
#include "cmTryRunCommand.h"
-#include "cmUnexpectedCommand.h"
#include "cmUnsetCommand.h"
#include "cmWhileCommand.h"
@@ -79,7 +78,6 @@
#include "cmAuxSourceDirectoryCommand.h"
#include "cmBuildNameCommand.h"
#include "cmCMakeHostSystemInformationCommand.h"
-#include "cmDisallowedCommand.h"
#include "cmExportCommand.h"
#include "cmExportLibraryDependenciesCommand.h"
#include "cmFLTKWrapUICommand.h"
@@ -109,169 +107,195 @@
void GetScriptingCommands(cmState* state)
{
- state->AddCommand(new cmBreakCommand);
- state->AddCommand(new cmCMakeMinimumRequired);
- state->AddCommand(new cmCMakePolicyCommand);
- state->AddCommand(new cmConfigureFileCommand);
- state->AddCommand(new cmContinueCommand);
- state->AddCommand(new cmExecProgramCommand);
- state->AddCommand(new cmExecuteProcessCommand);
- state->AddCommand(new cmFileCommand);
- state->AddCommand(new cmFindFileCommand);
- state->AddCommand(new cmFindLibraryCommand);
- state->AddCommand(new cmFindPackageCommand);
- state->AddCommand(new cmFindPathCommand);
- state->AddCommand(new cmFindProgramCommand);
- state->AddCommand(new cmForEachCommand);
- state->AddCommand(new cmFunctionCommand);
- state->AddCommand(new cmGetCMakePropertyCommand);
- state->AddCommand(new cmGetDirectoryPropertyCommand);
- state->AddCommand(new cmGetFilenameComponentCommand);
- state->AddCommand(new cmGetPropertyCommand);
- state->AddCommand(new cmIfCommand);
- state->AddCommand(new cmIncludeCommand);
- state->AddCommand(new cmListCommand);
- state->AddCommand(new cmMacroCommand);
- state->AddCommand(new cmMakeDirectoryCommand);
- state->AddCommand(new cmMarkAsAdvancedCommand);
- state->AddCommand(new cmMathCommand);
- state->AddCommand(new cmMessageCommand);
- state->AddCommand(new cmOptionCommand);
- state->AddCommand(new cmParseArgumentsCommand);
- state->AddCommand(new cmReturnCommand);
- state->AddCommand(new cmSeparateArgumentsCommand);
- state->AddCommand(new cmSetCommand);
- state->AddCommand(new cmSetDirectoryPropertiesCommand);
- state->AddCommand(new cmSetPropertyCommand);
- state->AddCommand(new cmSiteNameCommand);
- state->AddCommand(new cmStringCommand);
- state->AddCommand(new cmUnsetCommand);
- state->AddCommand(new cmWhileCommand);
+ state->AddBuiltinCommand("break", new cmBreakCommand);
+ state->AddBuiltinCommand("cmake_minimum_required",
+ new cmCMakeMinimumRequired);
+ state->AddBuiltinCommand("cmake_policy", new cmCMakePolicyCommand);
+ state->AddBuiltinCommand("configure_file", new cmConfigureFileCommand);
+ state->AddBuiltinCommand("continue", new cmContinueCommand);
+ state->AddBuiltinCommand("exec_program", new cmExecProgramCommand);
+ state->AddBuiltinCommand("execute_process", new cmExecuteProcessCommand);
+ state->AddBuiltinCommand("file", new cmFileCommand);
+ state->AddBuiltinCommand("find_file", new cmFindFileCommand);
+ state->AddBuiltinCommand("find_library", new cmFindLibraryCommand);
+ state->AddBuiltinCommand("find_package", new cmFindPackageCommand);
+ state->AddBuiltinCommand("find_path", new cmFindPathCommand);
+ state->AddBuiltinCommand("find_program", new cmFindProgramCommand);
+ state->AddBuiltinCommand("foreach", new cmForEachCommand);
+ state->AddBuiltinCommand("function", new cmFunctionCommand);
+ state->AddBuiltinCommand("get_cmake_property",
+ new cmGetCMakePropertyCommand);
+ state->AddBuiltinCommand("get_directory_property",
+ new cmGetDirectoryPropertyCommand);
+ state->AddBuiltinCommand("get_filename_component",
+ new cmGetFilenameComponentCommand);
+ state->AddBuiltinCommand("get_property", new cmGetPropertyCommand);
+ state->AddBuiltinCommand("if", new cmIfCommand);
+ state->AddBuiltinCommand("include", new cmIncludeCommand);
+ state->AddBuiltinCommand("list", new cmListCommand);
+ state->AddBuiltinCommand("macro", new cmMacroCommand);
+ state->AddBuiltinCommand("make_directory", new cmMakeDirectoryCommand);
+ state->AddBuiltinCommand("mark_as_advanced", new cmMarkAsAdvancedCommand);
+ state->AddBuiltinCommand("math", new cmMathCommand);
+ state->AddBuiltinCommand("message", new cmMessageCommand);
+ state->AddBuiltinCommand("option", new cmOptionCommand);
+ state->AddBuiltinCommand("cmake_parse_arguments",
+ new cmParseArgumentsCommand);
+ state->AddBuiltinCommand("return", new cmReturnCommand);
+ state->AddBuiltinCommand("separate_arguments",
+ new cmSeparateArgumentsCommand);
+ state->AddBuiltinCommand("set", new cmSetCommand);
+ state->AddBuiltinCommand("set_directory_properties",
+ new cmSetDirectoryPropertiesCommand);
+ state->AddBuiltinCommand("set_property", new cmSetPropertyCommand);
+ state->AddBuiltinCommand("site_name", new cmSiteNameCommand);
+ state->AddBuiltinCommand("string", new cmStringCommand);
+ state->AddBuiltinCommand("unset", new cmUnsetCommand);
+ state->AddBuiltinCommand("while", new cmWhileCommand);
- state->AddCommand(new cmUnexpectedCommand(
+ state->AddUnexpectedCommand(
"else", "An ELSE command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
- "the opening IF command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "the opening IF command.");
+ state->AddUnexpectedCommand(
"elseif", "An ELSEIF command was found outside of a proper "
- "IF ENDIF structure."));
- state->AddCommand(new cmUnexpectedCommand(
+ "IF ENDIF structure.");
+ state->AddUnexpectedCommand(
"endforeach", "An ENDFOREACH command was found outside of a proper "
"FOREACH ENDFOREACH structure. Or its arguments did "
- "not match the opening FOREACH command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "not match the opening FOREACH command.");
+ state->AddUnexpectedCommand(
"endfunction", "An ENDFUNCTION command was found outside of a proper "
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
- "match the opening FUNCTION command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "match the opening FUNCTION command.");
+ state->AddUnexpectedCommand(
"endif", "An ENDIF command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match "
- "the opening IF command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "the opening IF command.");
+ state->AddUnexpectedCommand(
"endmacro", "An ENDMACRO command was found outside of a proper "
"MACRO ENDMACRO structure. Or its arguments did not "
- "match the opening MACRO command."));
- state->AddCommand(new cmUnexpectedCommand(
+ "match the opening MACRO command.");
+ state->AddUnexpectedCommand(
"endwhile", "An ENDWHILE command was found outside of a proper "
"WHILE ENDWHILE structure. Or its arguments did not "
- "match the opening WHILE command."));
+ "match the opening WHILE command.");
#if defined(CMAKE_BUILD_WITH_CMAKE)
- state->AddCommand(new cmCMakeHostSystemInformationCommand);
- state->AddCommand(new cmRemoveCommand);
- state->AddCommand(new cmVariableWatchCommand);
- state->AddCommand(new cmWriteFileCommand);
+ state->AddBuiltinCommand("cmake_host_system_information",
+ new cmCMakeHostSystemInformationCommand);
+ state->AddBuiltinCommand("remove", new cmRemoveCommand);
+ state->AddBuiltinCommand("variable_watch", new cmVariableWatchCommand);
+ state->AddBuiltinCommand("write_file", new cmWriteFileCommand);
- state->AddCommand(new cmDisallowedCommand(
- new cmBuildNameCommand, cmPolicies::CMP0036,
- "The build_name command should not be called; see CMP0036."));
- state->AddCommand(new cmDisallowedCommand(
- new cmUseMangledMesaCommand, cmPolicies::CMP0030,
- "The use_mangled_mesa command should not be called; see CMP0030."));
+ state->AddDisallowedCommand(
+ "build_name", new cmBuildNameCommand, cmPolicies::CMP0036,
+ "The build_name command should not be called; see CMP0036.");
+ state->AddDisallowedCommand(
+ "use_mangled_mesa", new cmUseMangledMesaCommand, cmPolicies::CMP0030,
+ "The use_mangled_mesa command should not be called; see CMP0030.");
#endif
}
void GetProjectCommands(cmState* state)
{
- state->AddCommand(new cmAddCustomCommandCommand);
- state->AddCommand(new cmAddCustomTargetCommand);
- state->AddCommand(new cmAddDefinitionsCommand);
- state->AddCommand(new cmAddDependenciesCommand);
- state->AddCommand(new cmAddExecutableCommand);
- state->AddCommand(new cmAddLibraryCommand);
- state->AddCommand(new cmAddSubDirectoryCommand);
- state->AddCommand(new cmAddTestCommand);
- state->AddCommand(new cmBuildCommand);
- state->AddCommand(new cmCreateTestSourceList);
- state->AddCommand(new cmDefinePropertyCommand);
- state->AddCommand(new cmEnableLanguageCommand);
- state->AddCommand(new cmEnableTestingCommand);
- state->AddCommand(new cmGetSourceFilePropertyCommand);
- state->AddCommand(new cmGetTargetPropertyCommand);
- state->AddCommand(new cmGetTestPropertyCommand);
- state->AddCommand(new cmIncludeDirectoryCommand);
- state->AddCommand(new cmIncludeRegularExpressionCommand);
- state->AddCommand(new cmInstallCommand);
- state->AddCommand(new cmInstallFilesCommand);
- state->AddCommand(new cmInstallTargetsCommand);
- state->AddCommand(new cmLinkDirectoriesCommand);
- state->AddCommand(new cmProjectCommand);
- state->AddCommand(new cmSetSourceFilesPropertiesCommand);
- state->AddCommand(new cmSetTargetPropertiesCommand);
- state->AddCommand(new cmSetTestsPropertiesCommand);
- state->AddCommand(new cmSubdirCommand);
- state->AddCommand(new cmTargetLinkLibrariesCommand);
- state->AddCommand(new cmTryCompileCommand);
- state->AddCommand(new cmTryRunCommand);
+ state->AddBuiltinCommand("add_custom_command",
+ new cmAddCustomCommandCommand);
+ state->AddBuiltinCommand("add_custom_target", new cmAddCustomTargetCommand);
+ state->AddBuiltinCommand("add_definitions", new cmAddDefinitionsCommand);
+ state->AddBuiltinCommand("add_dependencies", new cmAddDependenciesCommand);
+ state->AddBuiltinCommand("add_executable", new cmAddExecutableCommand);
+ state->AddBuiltinCommand("add_library", new cmAddLibraryCommand);
+ state->AddBuiltinCommand("add_subdirectory", new cmAddSubDirectoryCommand);
+ state->AddBuiltinCommand("add_test", new cmAddTestCommand);
+ state->AddBuiltinCommand("build_command", new cmBuildCommand);
+ state->AddBuiltinCommand("create_test_sourcelist",
+ new cmCreateTestSourceList);
+ state->AddBuiltinCommand("define_property", new cmDefinePropertyCommand);
+ state->AddBuiltinCommand("enable_language", new cmEnableLanguageCommand);
+ state->AddBuiltinCommand("enable_testing", new cmEnableTestingCommand);
+ state->AddBuiltinCommand("get_source_file_property",
+ new cmGetSourceFilePropertyCommand);
+ state->AddBuiltinCommand("get_target_property",
+ new cmGetTargetPropertyCommand);
+ state->AddBuiltinCommand("get_test_property", new cmGetTestPropertyCommand);
+ state->AddBuiltinCommand("include_directories",
+ new cmIncludeDirectoryCommand);
+ state->AddBuiltinCommand("include_regular_expression",
+ new cmIncludeRegularExpressionCommand);
+ state->AddBuiltinCommand("install", new cmInstallCommand);
+ state->AddBuiltinCommand("install_files", new cmInstallFilesCommand);
+ state->AddBuiltinCommand("install_targets", new cmInstallTargetsCommand);
+ state->AddBuiltinCommand("link_directories", new cmLinkDirectoriesCommand);
+ state->AddBuiltinCommand("project", new cmProjectCommand);
+ state->AddBuiltinCommand("set_source_files_properties",
+ new cmSetSourceFilesPropertiesCommand);
+ state->AddBuiltinCommand("set_target_properties",
+ new cmSetTargetPropertiesCommand);
+ state->AddBuiltinCommand("set_tests_properties",
+ new cmSetTestsPropertiesCommand);
+ state->AddBuiltinCommand("subdirs", new cmSubdirCommand);
+ state->AddBuiltinCommand("target_link_libraries",
+ new cmTargetLinkLibrariesCommand);
+ state->AddBuiltinCommand("try_compile", new cmTryCompileCommand);
+ state->AddBuiltinCommand("try_run", new cmTryRunCommand);
#if defined(CMAKE_BUILD_WITH_CMAKE)
- state->AddCommand(new cmAddCompileOptionsCommand);
- state->AddCommand(new cmAuxSourceDirectoryCommand);
- state->AddCommand(new cmExportCommand);
- state->AddCommand(new cmFLTKWrapUICommand);
- state->AddCommand(new cmIncludeExternalMSProjectCommand);
- state->AddCommand(new cmInstallProgramsCommand);
- state->AddCommand(new cmLinkLibrariesCommand);
- state->AddCommand(new cmLoadCacheCommand);
- state->AddCommand(new cmQTWrapCPPCommand);
- state->AddCommand(new cmQTWrapUICommand);
- state->AddCommand(new cmRemoveDefinitionsCommand);
- state->AddCommand(new cmSourceGroupCommand);
- state->AddCommand(new cmTargetCompileDefinitionsCommand);
- state->AddCommand(new cmTargetCompileFeaturesCommand);
- state->AddCommand(new cmTargetCompileOptionsCommand);
- state->AddCommand(new cmTargetIncludeDirectoriesCommand);
- state->AddCommand(new cmTargetSourcesCommand);
+ state->AddBuiltinCommand("add_compile_options",
+ new cmAddCompileOptionsCommand);
+ state->AddBuiltinCommand("aux_source_directory",
+ new cmAuxSourceDirectoryCommand);
+ state->AddBuiltinCommand("export", new cmExportCommand);
+ state->AddBuiltinCommand("fltk_wrap_ui", new cmFLTKWrapUICommand);
+ state->AddBuiltinCommand("include_external_msproject",
+ new cmIncludeExternalMSProjectCommand);
+ state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand);
+ state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand);
+ state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand);
+ state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand);
+ state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand);
+ state->AddBuiltinCommand("remove_definitions",
+ new cmRemoveDefinitionsCommand);
+ state->AddBuiltinCommand("source_group", new cmSourceGroupCommand);
+ state->AddBuiltinCommand("target_compile_definitions",
+ new cmTargetCompileDefinitionsCommand);
+ state->AddBuiltinCommand("target_compile_features",
+ new cmTargetCompileFeaturesCommand);
+ state->AddBuiltinCommand("target_compile_options",
+ new cmTargetCompileOptionsCommand);
+ state->AddBuiltinCommand("target_include_directories",
+ new cmTargetIncludeDirectoriesCommand);
+ state->AddBuiltinCommand("target_sources", new cmTargetSourcesCommand);
- state->AddCommand(new cmDisallowedCommand(
- new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
+ state->AddDisallowedCommand(
+ "export_library_dependencies", new cmExportLibraryDependenciesCommand,
+ cmPolicies::CMP0033,
"The export_library_dependencies command should not be called; "
- "see CMP0033."));
- state->AddCommand(new cmDisallowedCommand(
- new cmLoadCommandCommand, cmPolicies::CMP0031,
- "The load_command command should not be called; see CMP0031."));
- state->AddCommand(new cmDisallowedCommand(
- new cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
- "The output_required_files command should not be called; "
- "see CMP0032."));
- state->AddCommand(new cmDisallowedCommand(
- new cmSubdirDependsCommand, cmPolicies::CMP0029,
- "The subdir_depends command should not be called; see CMP0029."));
- state->AddCommand(new cmDisallowedCommand(
- new cmUtilitySourceCommand, cmPolicies::CMP0034,
- "The utility_source command should not be called; see CMP0034."));
- state->AddCommand(new cmDisallowedCommand(
- new cmVariableRequiresCommand, cmPolicies::CMP0035,
- "The variable_requires command should not be called; see CMP0035."));
+ "see CMP0033.");
+ state->AddDisallowedCommand(
+ "load_command", new cmLoadCommandCommand, cmPolicies::CMP0031,
+ "The load_command command should not be called; see CMP0031.");
+ state->AddDisallowedCommand(
+ "output_required_files", new cmOutputRequiredFilesCommand,
+ cmPolicies::CMP0032,
+ "The output_required_files command should not be called; see CMP0032.");
+ state->AddDisallowedCommand(
+ "subdir_depends", new cmSubdirDependsCommand, cmPolicies::CMP0029,
+ "The subdir_depends command should not be called; see CMP0029.");
+ state->AddDisallowedCommand(
+ "utility_source", new cmUtilitySourceCommand, cmPolicies::CMP0034,
+ "The utility_source command should not be called; see CMP0034.");
+ state->AddDisallowedCommand(
+ "variable_requires", new cmVariableRequiresCommand, cmPolicies::CMP0035,
+ "The variable_requires command should not be called; see CMP0035.");
#endif
}
void GetProjectCommandsInScriptMode(cmState* state)
{
#define CM_UNEXPECTED_PROJECT_COMMAND(NAME) \
- state->AddCommand(new cmUnexpectedCommand(NAME, "command is not " \
- "scriptable"))
+ state->AddUnexpectedCommand(NAME, "command is not scriptable")
CM_UNEXPECTED_PROJECT_COMMAND("add_compile_options");
CM_UNEXPECTED_PROJECT_COMMAND("add_custom_command");
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 402423d4d0..6cebbd258c 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -25,11 +25,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "configure_file"; }
-
private:
int ConfigureFile();
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 4b416a49aa..92bc68e855 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "continue"; }
};
#endif
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 47391f383a..f1f1e4b8a6 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "create_test_sourcelist"; }
};
#endif
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 7a6e127f18..bc120c5645 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -24,11 +24,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "define_property"; }
-
private:
std::string PropertyName;
std::string BriefDocs;
diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h
index 38d1d933a3..0030116b8d 100644
--- a/Source/cmDisallowedCommand.h
+++ b/Source/cmDisallowedCommand.h
@@ -42,8 +42,6 @@ public:
return this->Command->HasFinalPass();
}
- std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); }
-
private:
cmCommand* Command;
cmPolicies::PolicyID Policy;
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index 0748283705..33c1c22bfa 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -34,11 +34,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "enable_language"; }
};
#endif
diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h
index b4ac068a22..e249662214 100644
--- a/Source/cmEnableTestingCommand.h
+++ b/Source/cmEnableTestingCommand.h
@@ -39,11 +39,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "enable_testing"; }
};
#endif
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 2a59612aad..6463c4db5a 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "exec_program"; }
-
private:
static bool RunCommand(const char* command, std::string& output, int& retVal,
const char* directory = CM_NULLPTR,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index e57e22db01..08fde0adc4 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "execute_process"; }
};
#endif
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index b95ea86ada..c47bc42b95 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "export"; }
-
private:
cmCommandArgumentsHelper Helper;
cmCommandArgumentGroup ArgumentGroup;
diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h
index 4d3e36e039..5559af94b9 100644
--- a/Source/cmExportLibraryDependenciesCommand.h
+++ b/Source/cmExportLibraryDependenciesCommand.h
@@ -21,10 +21,6 @@ public:
}
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE
- {
- return "export_library_dependencies";
- }
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE { return true; }
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index 7dde9c1722..d8045ab6a4 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -43,11 +43,6 @@ public:
void FinalPass() CM_OVERRIDE;
bool HasFinalPass() const CM_OVERRIDE { return true; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "fltk_wrap_ui"; }
-
private:
/**
* List of produced files.
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index ff0b35e234..d09ef42f16 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -31,11 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "file"; }
-
protected:
bool HandleRename(std::vector<std::string> const& args);
bool HandleRemove(std::vector<std::string> const& args, bool recurse);
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index 489df655fa..bf57fecd3e 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -5,8 +5,6 @@
#include "cmConfigure.h"
-#include <string>
-
#include "cmFindPathCommand.h"
class cmCommand;
@@ -27,7 +25,6 @@ public:
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE { return new cmFindFileCommand; }
- std::string GetName() const CM_OVERRIDE { return "find_file"; }
};
#endif
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 41af976355..9d38eab33c 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_library"; }
-
protected:
void AddArchitecturePaths(const char* suffix);
void AddArchitecturePath(std::string const& dir,
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index e4ecfad4e6..318b1dc87d 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -60,11 +60,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_package"; }
-
private:
class PathLabel : public cmFindCommon::PathLabel
{
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 92849c3932..3761145b2c 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_path"; }
-
bool IncludeFileInPath;
private:
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index af56aeffd1..a0d6af9374 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -37,11 +37,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "find_program"; }
-
private:
std::string FindProgram();
std::string FindNormalProgram();
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 30f03423e8..7c8a6d8363 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -48,11 +48,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "foreach"; }
-
private:
bool HandleInMode(std::vector<std::string> const& args);
};
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index dccc29f51a..ee52bde378 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -21,11 +21,6 @@ public:
~cmFunctionHelperCommand() CM_OVERRIDE {}
/**
- * This determines if the command is defined in a cmake script.
- */
- bool IsUserDefined() const CM_OVERRIDE { return true; }
-
- /**
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE
@@ -52,11 +47,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
@@ -149,11 +139,7 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked(
f->Functions = this->Functions;
f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
-
- std::string newName = "_" + this->Args[0];
- mf.GetState()->RenameCommand(this->Args[0], newName);
- mf.GetState()->AddCommand(f);
-
+ mf.GetState()->AddScriptedCommand(this->Args[0], f);
// remove the function blocker now that the function is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index fa13aa4464..f263126327 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -44,11 +44,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "function"; }
};
#endif
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index b0ddb2206f..9dfc40fda5 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -23,11 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
};
#endif
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index f91a4661b4..7d97950659 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -24,11 +24,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
-
private:
void StoreResult(const std::string& variable, const char* prop);
};
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index cf64564a1d..c8a23c70ec 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
};
#endif
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index 7bbcec0a4f..6497801688 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -26,11 +26,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_property"; }
-
private:
enum OutType
{
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 558e2abb04..e96bb29ed0 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -23,14 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "get_source_file_property";
- }
};
#endif
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 9cebb3bcfd..5de3225635 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -23,11 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_target_property"; }
};
#endif
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index d3d10cbfa1..b17e7a1ccf 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -23,11 +23,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "get_test_property"; }
};
#endif
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index c6c44cbadc..5877a7d12d 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -64,11 +64,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "if"; }
-
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
const cmMakefile* mf, cmExpandedCommandArgument const& argument);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 5a37800733..16dda0ef54 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "include"; }
};
#endif
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index abe0c05813..12de698cb2 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "include_directories"; }
-
protected:
// used internally
void GetIncludes(const std::string& arg, std::vector<std::string>& incs);
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 5274f9ee40..375646fa64 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -36,14 +36,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "include_external_msproject";
- }
};
#endif
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index a0033609b4..bac4b8fc37 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -35,14 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "include_regular_expression";
- }
};
#endif
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index fde629b388..f5d1f9265e 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install"; }
-
private:
bool HandleScriptMode(std::vector<std::string> const& args);
bool HandleTargetsMode(std::vector<std::string> const& args);
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index 588c2896a8..b3c27b827f 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_files"; }
-
- /**
* This is called at the end after all the information
* specified by the command is accumulated. Most commands do
* not implement this method. At this point, reading and
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index 2381d798b6..242fb953d4 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -34,11 +34,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_programs"; }
-
- /**
* This is called at the end after all the information
* specified by the command is accumulated. Most commands do
* not implement this method. At this point, reading and
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 77f461aee4..cc8484365b 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "install_targets"; }
};
#endif
diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h
index 334b1b8df3..b64e48d702 100644
--- a/Source/cmLinkDirectoriesCommand.h
+++ b/Source/cmLinkDirectoriesCommand.h
@@ -35,11 +35,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "link_directories"; }
-
private:
void AddLinkDir(std::string const& dir);
};
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 430e5a81df..f1b3a68164 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "link_libraries"; }
};
#endif
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 7272ea1b89..7789f7df1e 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -31,11 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "list"; }
-
protected:
bool HandleLengthCommand(std::vector<std::string> const& args);
bool HandleGetCommand(std::vector<std::string> const& args);
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index 8dee973b7c..1a8a0fc4c7 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "load_cache"; }
-
protected:
std::set<std::string> VariablesToRead;
std::string Prefix;
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index 5cf185347e..92a32a147e 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -66,11 +66,6 @@ public:
return this->info.FinalPass != CM_NULLPTR;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return info.Name; }
-
static const char* LastName;
static void TrapsForSignals(int sig)
{
@@ -246,7 +241,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker and set it up
cmLoadedCommand* f = new cmLoadedCommand();
(*initFunction)(&f->info);
- this->Makefile->GetState()->AddCommand(f);
+ this->Makefile->GetState()->AddScriptedCommand(args[0], f);
return true;
}
this->SetError("Attempt to load command failed. "
diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h
index 97a6bd743c..030786e3da 100644
--- a/Source/cmLoadCommandCommand.h
+++ b/Source/cmLoadCommandCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmLoadCommandCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "load_command"; }
};
#endif
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 507b579591..a6a9ea3165 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -22,11 +22,6 @@ public:
~cmMacroHelperCommand() CM_OVERRIDE {}
/**
- * This determines if the command is defined in a cmake script.
- */
- bool IsUserDefined() const CM_OVERRIDE { return true; }
-
- /**
* This is a virtual constructor for the command.
*/
cmCommand* Clone() CM_OVERRIDE
@@ -53,11 +48,6 @@ public:
return false;
}
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return this->Args[0]; }
-
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
cmPolicies::PolicyMap Policies;
@@ -184,10 +174,7 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
f->Functions = this->Functions;
f->FilePath = this->GetStartingContext().FilePath;
mf.RecordPolicies(f->Policies);
- std::string newName = "_" + this->Args[0];
- mf.GetState()->RenameCommand(this->Args[0], newName);
- mf.GetState()->AddCommand(f);
-
+ mf.GetState()->AddScriptedCommand(this->Args[0], f);
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(this, lff);
return true;
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index fd9c92bc54..0d35fe06eb 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -44,11 +44,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "macro"; }
};
#endif
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index e2f093246e..af72eab966 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -35,11 +35,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "make_directory"; }
};
#endif
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 4f80746e21..a7791a9325 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; }
};
#endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index ef0eb4a717..67dbdda37c 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -28,11 +28,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "math"; }
-
protected:
bool HandleExprCommand(std::vector<std::string> const& args);
};
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index fd2dbe7666..96939e514f 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -30,11 +30,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "message"; }
};
#endif
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 0227357af5..634e3a8249 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "option"; }
};
#endif
diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h
index e261eb06df..d20bfbdc18 100644
--- a/Source/cmOutputRequiredFilesCommand.h
+++ b/Source/cmOutputRequiredFilesCommand.h
@@ -21,7 +21,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmOutputRequiredFilesCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "output_required_files"; }
void ListDependencies(cmDependInformation const* info, FILE* fout,
std::set<cmDependInformation const*>* visited);
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index f3de5b6903..359fb85b98 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -29,11 +29,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
};
#endif
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index 8fc90d24bc..3c579ac9d1 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -34,11 +34,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "project"; }
};
#endif
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 34adf29b93..ad1ccf38da 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "qt_wrap_cpp"; }
};
#endif
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 279d4e9cf9..ac7ab01c7c 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "qt_wrap_ui"; }
};
#endif
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 84e591db9b..f2e89f6e13 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "remove"; }
};
#endif
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 2f6c924ca4..9a9a5d5354 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "remove_definitions"; }
};
#endif
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index a4a6283d5c..87900e7e9c 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "return"; }
};
#endif
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index e4df5da085..6bf8549cfa 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
};
#endif
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index e3a31757ec..c0858b15b0 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set"; }
};
#endif
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index 4657b66ee8..8832b3389b 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -29,14 +29,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "set_directory_properties";
- }
-
- /**
* Static entry point for use by other commands
*/
static bool RunCommand(cmMakefile* mf,
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 7f5c977fbe..08158244a7 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -31,11 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_property"; }
-
private:
std::set<std::string> Names;
std::string PropertyName;
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 7dce4377b2..2e22dc9eff 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -28,14 +28,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "set_source_files_properties";
- }
-
static bool RunCommand(cmMakefile* mf,
std::vector<std::string>::const_iterator filebeg,
std::vector<std::string>::const_iterator fileend,
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index bb34d1e739..4256181573 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -26,11 +26,6 @@ public:
cmExecutionStatus& status) CM_OVERRIDE;
/**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_target_properties"; }
-
- /**
* Used by this command and cmSetPropertiesCommand
*/
static bool SetOneTarget(const std::string& tname,
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 56a864ffb9..90f004c344 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -25,11 +25,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "set_tests_properties"; }
-
static bool SetOneTest(const std::string& tname,
std::vector<std::string>& propertyPairs,
cmMakefile* mf, std::string& errors);
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index e133c6c4a0..6c65480ed8 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "site_name"; }
};
#endif
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index 3086177a84..7d56b0d656 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "source_group"; }
-
private:
bool processTree(const std::vector<std::string>& args,
std::string& errorMsg);
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 43f439c9d9..ce9f470a70 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()
@@ -34,7 +36,8 @@ cmState::cmState()
cmState::~cmState()
{
delete this->CacheManager;
- cmDeleteAll(this->Commands);
+ cmDeleteAll(this->BuiltinCommands);
+ cmDeleteAll(this->ScriptedCommands);
}
const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType)
@@ -375,84 +378,92 @@ void cmState::SetIsGeneratorMultiConfig(bool b)
this->IsGeneratorMultiConfig = b;
}
-void cmState::RenameCommand(std::string const& oldName,
- std::string const& newName)
+void cmState::AddBuiltinCommand(std::string const& name, cmCommand* command)
{
- // if the command already exists, free the old one
- std::string sOldName = cmSystemTools::LowerCase(oldName);
- std::string sNewName = cmSystemTools::LowerCase(newName);
- std::map<std::string, cmCommand*>::iterator pos =
- this->Commands.find(sOldName);
- if (pos == this->Commands.end()) {
- return;
- }
- cmCommand* cmd = pos->second;
+ assert(name == cmSystemTools::LowerCase(name));
+ assert(this->BuiltinCommands.find(name) == this->BuiltinCommands.end());
+ this->BuiltinCommands.insert(std::make_pair(name, command));
+}
- pos = this->Commands.find(sNewName);
- if (pos != this->Commands.end()) {
- delete pos->second;
- this->Commands.erase(pos);
- }
- this->Commands.insert(std::make_pair(sNewName, cmd));
- pos = this->Commands.find(sOldName);
- this->Commands.erase(pos);
+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));
}
-void cmState::AddCommand(cmCommand* command)
+void cmState::AddScriptedCommand(std::string const& name, cmCommand* command)
{
- std::string name = cmSystemTools::LowerCase(command->GetName());
+ std::string sName = cmSystemTools::LowerCase(name);
+
+ // if the command already exists, give a new name to the old command.
+ if (cmCommand* oldCmd = this->GetCommand(sName)) {
+ std::string const newName = "_" + sName;
+ std::map<std::string, cmCommand*>::iterator pos =
+ this->ScriptedCommands.find(newName);
+ if (pos != this->ScriptedCommands.end()) {
+ delete pos->second;
+ this->ScriptedCommands.erase(pos);
+ }
+ this->ScriptedCommands.insert(std::make_pair(newName, oldCmd->Clone()));
+ }
+
// if the command already exists, free the old one
- std::map<std::string, cmCommand*>::iterator pos = this->Commands.find(name);
- if (pos != this->Commands.end()) {
+ std::map<std::string, cmCommand*>::iterator pos =
+ this->ScriptedCommands.find(sName);
+ if (pos != this->ScriptedCommands.end()) {
delete pos->second;
- this->Commands.erase(pos);
+ this->ScriptedCommands.erase(pos);
}
- this->Commands.insert(std::make_pair(name, command));
+ this->ScriptedCommands.insert(std::make_pair(sName, command));
}
cmCommand* cmState::GetCommand(std::string const& name) const
{
- cmCommand* command = CM_NULLPTR;
std::string sName = cmSystemTools::LowerCase(name);
- std::map<std::string, cmCommand*>::const_iterator pos =
- this->Commands.find(sName);
- if (pos != this->Commands.end()) {
- command = (*pos).second;
+ std::map<std::string, cmCommand*>::const_iterator pos;
+ pos = this->ScriptedCommands.find(sName);
+ if (pos != this->ScriptedCommands.end()) {
+ return pos->second;
+ }
+ pos = this->BuiltinCommands.find(sName);
+ if (pos != this->BuiltinCommands.end()) {
+ return pos->second;
}
- return command;
+ return CM_NULLPTR;
}
std::vector<std::string> cmState::GetCommandNames() const
{
std::vector<std::string> commandNames;
- commandNames.reserve(this->Commands.size());
- std::map<std::string, cmCommand*>::const_iterator cmds =
- this->Commands.begin();
- for (; cmds != this->Commands.end(); ++cmds) {
+ commandNames.reserve(this->BuiltinCommands.size() +
+ this->ScriptedCommands.size());
+ for (std::map<std::string, cmCommand*>::const_iterator cmds =
+ this->BuiltinCommands.begin();
+ cmds != this->BuiltinCommands.end(); ++cmds) {
commandNames.push_back(cmds->first);
}
+ for (std::map<std::string, cmCommand*>::const_iterator cmds =
+ this->ScriptedCommands.begin();
+ cmds != this->ScriptedCommands.end(); ++cmds) {
+ commandNames.push_back(cmds->first);
+ }
+ std::sort(commandNames.begin(), commandNames.end());
+ commandNames.erase(std::unique(commandNames.begin(), commandNames.end()),
+ commandNames.end());
return commandNames;
}
void cmState::RemoveUserDefinedCommands()
{
- std::vector<cmCommand*> renamedCommands;
- for (std::map<std::string, cmCommand*>::iterator j = this->Commands.begin();
- j != this->Commands.end();) {
- if (j->second->IsUserDefined()) {
- delete j->second;
- this->Commands.erase(j++);
- } else if (j->first != j->second->GetName()) {
- renamedCommands.push_back(j->second);
- this->Commands.erase(j++);
- } else {
- ++j;
- }
- }
- for (std::vector<cmCommand*>::const_iterator it = renamedCommands.begin();
- it != renamedCommands.end(); ++it) {
- this->Commands[cmSystemTools::LowerCase((*it)->GetName())] = *it;
- }
+ cmDeleteAll(this->ScriptedCommands);
+ this->ScriptedCommands.clear();
}
void cmState::SetGlobalProperty(const std::string& prop, const char* value)
diff --git a/Source/cmState.h b/Source/cmState.h
index 240d75bd98..1a5738ff42 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -12,6 +12,7 @@
#include "cmDefinitions.h"
#include "cmLinkedTree.h"
+#include "cmPolicies.h"
#include "cmProperty.h"
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
@@ -120,8 +121,11 @@ public:
void SetIsGeneratorMultiConfig(bool b);
cmCommand* GetCommand(std::string const& name) const;
- void AddCommand(cmCommand* command);
- void RenameCommand(std::string const& oldName, std::string const& newName);
+ void AddBuiltinCommand(std::string const& name, cmCommand* command);
+ void AddDisallowedCommand(std::string const& name, cmCommand* command,
+ cmPolicies::PolicyID policy, const char* message);
+ void AddUnexpectedCommand(std::string const& name, const char* error);
+ void AddScriptedCommand(std::string const& name, cmCommand* command);
void RemoveUserDefinedCommands();
std::vector<std::string> GetCommandNames() const;
@@ -160,7 +164,8 @@ private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
- std::map<std::string, cmCommand*> Commands;
+ std::map<std::string, cmCommand*> BuiltinCommands;
+ std::map<std::string, cmCommand*> ScriptedCommands;
cmPropertyMap GlobalProperties;
cmCacheManager* CacheManager;
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index dc3ce5a19f..88015ad5e3 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -31,11 +31,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "string"; }
-
protected:
bool HandleConfigureCommand(std::vector<std::string> const& args);
bool HandleAsciiCommand(std::vector<std::string> const& args);
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index ce2168d7c3..a2af0fd586 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -33,11 +33,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "subdirs"; }
};
#endif
diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h
index ae8fbafd5c..d8ea9284f8 100644
--- a/Source/cmSubdirDependsCommand.h
+++ b/Source/cmSubdirDependsCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmSubdirDependsCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "subdir_depends"; }
};
#endif
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index 663b9d0320..11abf571c1 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -32,14 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "target_compile_definitions";
- }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h
index 95214bf01e..9908680045 100644
--- a/Source/cmTargetCompileFeaturesCommand.h
+++ b/Source/cmTargetCompileFeaturesCommand.h
@@ -21,8 +21,6 @@ class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "target_compile_features"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h
index e4dfa75fbb..b5408f7cb0 100644
--- a/Source/cmTargetCompileOptionsCommand.h
+++ b/Source/cmTargetCompileOptionsCommand.h
@@ -29,11 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_compile_options"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index d6d33f29fb..374a867dcd 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -32,14 +32,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE
- {
- return "target_include_directories";
- }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index bfa233e574..3fd20accdc 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -36,11 +36,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_link_libraries"; }
-
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h
index 6cc1abce83..09ba72915d 100644
--- a/Source/cmTargetSourcesCommand.h
+++ b/Source/cmTargetSourcesCommand.h
@@ -29,11 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "target_sources"; }
-
private:
void HandleImportedTarget(const std::string& tgt) CM_OVERRIDE;
void HandleMissingTarget(const std::string& name) CM_OVERRIDE;
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 8972f7e96d..4836548224 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -32,11 +32,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "try_compile"; }
};
#endif
diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h
index b086dde68d..c27b026adc 100644
--- a/Source/cmTryRunCommand.h
+++ b/Source/cmTryRunCommand.h
@@ -33,11 +33,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "try_run"; }
-
private:
void RunExecutable(const std::string& runArgs,
std::string* runOutputContents);
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
index 1605997a17..995d8a5d6f 100644
--- a/Source/cmUnexpectedCommand.h
+++ b/Source/cmUnexpectedCommand.h
@@ -29,8 +29,6 @@ public:
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return this->Name; }
-
private:
std::string Name;
const char* Error;
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index d60bd3ed8a..2a1f3f0a68 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -31,11 +31,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "unset"; }
};
#endif
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index 104614ab7c..5118829892 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -18,7 +18,7 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmUseMangledMesaCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; }
+
protected:
void CopyAndFullPathMesaHeader(const char* source, const char* outdir);
};
diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h
index fa818bf9af..a95b48d6ae 100644
--- a/Source/cmUtilitySourceCommand.h
+++ b/Source/cmUtilitySourceCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmUtilitySourceCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "utility_source"; }
};
#endif
diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h
index 6afb11a822..9808d5f0c1 100644
--- a/Source/cmVariableRequiresCommand.h
+++ b/Source/cmVariableRequiresCommand.h
@@ -18,7 +18,6 @@ public:
cmCommand* Clone() CM_OVERRIDE { return new cmVariableRequiresCommand; }
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
- std::string GetName() const CM_OVERRIDE { return "variable_requires"; }
};
#endif
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index ca338e61c4..9f0439175a 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -42,11 +42,6 @@ public:
stay alive since it owns variable watch callback information. */
bool HasFinalPass() const CM_OVERRIDE { return true; }
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "variable_watch"; }
-
protected:
std::set<std::string> WatchedVariables;
};
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index d3530634a6..a95e4c30c3 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -57,11 +57,6 @@ public:
{
return false;
}
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "while"; }
};
#endif
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index aea8653da1..19922cdf35 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -30,11 +30,6 @@ public:
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
-
- /**
- * The name of the command as specified in CMakeList.txt.
- */
- std::string GetName() const CM_OVERRIDE { return "write_file"; }
};
#endif
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index f472b8ae62..6e65955077 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -289,7 +289,9 @@ int do_cmake(int ac, char const* const* av)
int ret = cm.GetSystemInformation(args);
return ret;
}
- cmake cm(cmake::RoleProject);
+ cmake::Role const role =
+ workingMode == cmake::NORMAL_MODE ? cmake::RoleProject : cmake::RoleScript;
+ cmake cm(role);
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
diff --git a/bootstrap b/bootstrap
index 876f53b9f0..70da70ebfd 100755
--- a/bootstrap
+++ b/bootstrap
@@ -274,6 +274,7 @@ CMAKE_CXX_SOURCES="\
cmDefinitions \
cmDepends \
cmDependsC \
+ cmDisallowedCommand \
cmDocumentationFormatter \
cmEnableLanguageCommand \
cmEnableTestingCommand \