mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
cmCommands: add commands directly to cmState
This commit is contained in:
+107
-114
@@ -1,6 +1,7 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmCommands.h"
|
#include "cmCommands.h"
|
||||||
|
#include "cmState.h"
|
||||||
|
|
||||||
#include "cmAddCustomCommandCommand.h"
|
#include "cmAddCustomCommandCommand.h"
|
||||||
#include "cmAddCustomTargetCommand.h"
|
#include "cmAddCustomTargetCommand.h"
|
||||||
@@ -105,170 +106,162 @@
|
|||||||
#include "cmWriteFileCommand.h"
|
#include "cmWriteFileCommand.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<cmCommand*> GetScriptingCommands()
|
void GetScriptingCommands(cmState* state)
|
||||||
{
|
{
|
||||||
std::vector<cmCommand*> commands;
|
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);
|
||||||
|
|
||||||
commands.push_back(new cmBreakCommand);
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
commands.push_back(new cmCMakeMinimumRequired);
|
|
||||||
commands.push_back(new cmCMakePolicyCommand);
|
|
||||||
commands.push_back(new cmConfigureFileCommand);
|
|
||||||
commands.push_back(new cmContinueCommand);
|
|
||||||
commands.push_back(new cmExecProgramCommand);
|
|
||||||
commands.push_back(new cmExecuteProcessCommand);
|
|
||||||
commands.push_back(new cmFileCommand);
|
|
||||||
commands.push_back(new cmFindFileCommand);
|
|
||||||
commands.push_back(new cmFindLibraryCommand);
|
|
||||||
commands.push_back(new cmFindPackageCommand);
|
|
||||||
commands.push_back(new cmFindPathCommand);
|
|
||||||
commands.push_back(new cmFindProgramCommand);
|
|
||||||
commands.push_back(new cmForEachCommand);
|
|
||||||
commands.push_back(new cmFunctionCommand);
|
|
||||||
commands.push_back(new cmGetCMakePropertyCommand);
|
|
||||||
commands.push_back(new cmGetDirectoryPropertyCommand);
|
|
||||||
commands.push_back(new cmGetFilenameComponentCommand);
|
|
||||||
commands.push_back(new cmGetPropertyCommand);
|
|
||||||
commands.push_back(new cmIfCommand);
|
|
||||||
commands.push_back(new cmIncludeCommand);
|
|
||||||
commands.push_back(new cmListCommand);
|
|
||||||
commands.push_back(new cmMacroCommand);
|
|
||||||
commands.push_back(new cmMakeDirectoryCommand);
|
|
||||||
commands.push_back(new cmMarkAsAdvancedCommand);
|
|
||||||
commands.push_back(new cmMathCommand);
|
|
||||||
commands.push_back(new cmMessageCommand);
|
|
||||||
commands.push_back(new cmOptionCommand);
|
|
||||||
commands.push_back(new cmParseArgumentsCommand);
|
|
||||||
commands.push_back(new cmReturnCommand);
|
|
||||||
commands.push_back(new cmSeparateArgumentsCommand);
|
|
||||||
commands.push_back(new cmSetCommand);
|
|
||||||
commands.push_back(new cmSetDirectoryPropertiesCommand);
|
|
||||||
commands.push_back(new cmSetPropertyCommand);
|
|
||||||
commands.push_back(new cmSiteNameCommand);
|
|
||||||
commands.push_back(new cmStringCommand);
|
|
||||||
commands.push_back(new cmUnsetCommand);
|
|
||||||
commands.push_back(new cmWhileCommand);
|
|
||||||
|
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
|
||||||
"else", "An ELSE command was found outside of a proper "
|
"else", "An ELSE command was found outside of a proper "
|
||||||
"IF ENDIF structure. Or its arguments did not match "
|
"IF ENDIF structure. Or its arguments did not match "
|
||||||
"the opening IF command."));
|
"the opening IF command."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"elseif", "An ELSEIF command was found outside of a proper "
|
"elseif", "An ELSEIF command was found outside of a proper "
|
||||||
"IF ENDIF structure."));
|
"IF ENDIF structure."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"endforeach", "An ENDFOREACH command was found outside of a proper "
|
"endforeach", "An ENDFOREACH command was found outside of a proper "
|
||||||
"FOREACH ENDFOREACH structure. Or its arguments did "
|
"FOREACH ENDFOREACH structure. Or its arguments did "
|
||||||
"not match the opening FOREACH command."));
|
"not match the opening FOREACH command."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"endfunction", "An ENDFUNCTION command was found outside of a proper "
|
"endfunction", "An ENDFUNCTION command was found outside of a proper "
|
||||||
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
|
"FUNCTION ENDFUNCTION structure. Or its arguments did not "
|
||||||
"match the opening FUNCTION command."));
|
"match the opening FUNCTION command."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"endif", "An ENDIF command was found outside of a proper "
|
"endif", "An ENDIF command was found outside of a proper "
|
||||||
"IF ENDIF structure. Or its arguments did not match "
|
"IF ENDIF structure. Or its arguments did not match "
|
||||||
"the opening IF command."));
|
"the opening IF command."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"endmacro", "An ENDMACRO command was found outside of a proper "
|
"endmacro", "An ENDMACRO command was found outside of a proper "
|
||||||
"MACRO ENDMACRO structure. Or its arguments did not "
|
"MACRO ENDMACRO structure. Or its arguments did not "
|
||||||
"match the opening MACRO command."));
|
"match the opening MACRO command."));
|
||||||
commands.push_back(new cmUnexpectedCommand(
|
state->AddCommand(new cmUnexpectedCommand(
|
||||||
"endwhile", "An ENDWHILE command was found outside of a proper "
|
"endwhile", "An ENDWHILE command was found outside of a proper "
|
||||||
"WHILE ENDWHILE structure. Or its arguments did not "
|
"WHILE ENDWHILE structure. Or its arguments did not "
|
||||||
"match the opening WHILE command."));
|
"match the opening WHILE command."));
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
commands.push_back(new cmCMakeHostSystemInformationCommand);
|
state->AddCommand(new cmCMakeHostSystemInformationCommand);
|
||||||
commands.push_back(new cmRemoveCommand);
|
state->AddCommand(new cmRemoveCommand);
|
||||||
commands.push_back(new cmVariableWatchCommand);
|
state->AddCommand(new cmVariableWatchCommand);
|
||||||
commands.push_back(new cmWriteFileCommand);
|
state->AddCommand(new cmWriteFileCommand);
|
||||||
|
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmBuildNameCommand, cmPolicies::CMP0036,
|
new cmBuildNameCommand, cmPolicies::CMP0036,
|
||||||
"The build_name command should not be called; see CMP0036."));
|
"The build_name command should not be called; see CMP0036."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmUseMangledMesaCommand, cmPolicies::CMP0030,
|
new cmUseMangledMesaCommand, cmPolicies::CMP0030,
|
||||||
"The use_mangled_mesa command should not be called; see CMP0030."));
|
"The use_mangled_mesa command should not be called; see CMP0030."));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return commands;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cmCommand*> GetProjectCommands()
|
void GetProjectCommands(cmState* state)
|
||||||
{
|
{
|
||||||
std::vector<cmCommand*> commands;
|
state->AddCommand(new cmAddCustomCommandCommand);
|
||||||
|
state->AddCommand(new cmAddCustomTargetCommand);
|
||||||
commands.push_back(new cmAddCustomCommandCommand);
|
state->AddCommand(new cmAddDefinitionsCommand);
|
||||||
commands.push_back(new cmAddCustomTargetCommand);
|
state->AddCommand(new cmAddDependenciesCommand);
|
||||||
commands.push_back(new cmAddDefinitionsCommand);
|
state->AddCommand(new cmAddExecutableCommand);
|
||||||
commands.push_back(new cmAddDependenciesCommand);
|
state->AddCommand(new cmAddLibraryCommand);
|
||||||
commands.push_back(new cmAddExecutableCommand);
|
state->AddCommand(new cmAddSubDirectoryCommand);
|
||||||
commands.push_back(new cmAddLibraryCommand);
|
state->AddCommand(new cmAddTestCommand);
|
||||||
commands.push_back(new cmAddSubDirectoryCommand);
|
state->AddCommand(new cmBuildCommand);
|
||||||
commands.push_back(new cmAddTestCommand);
|
state->AddCommand(new cmCreateTestSourceList);
|
||||||
commands.push_back(new cmBuildCommand);
|
state->AddCommand(new cmDefinePropertyCommand);
|
||||||
commands.push_back(new cmCreateTestSourceList);
|
state->AddCommand(new cmEnableLanguageCommand);
|
||||||
commands.push_back(new cmDefinePropertyCommand);
|
state->AddCommand(new cmEnableTestingCommand);
|
||||||
commands.push_back(new cmEnableLanguageCommand);
|
state->AddCommand(new cmGetSourceFilePropertyCommand);
|
||||||
commands.push_back(new cmEnableTestingCommand);
|
state->AddCommand(new cmGetTargetPropertyCommand);
|
||||||
commands.push_back(new cmGetSourceFilePropertyCommand);
|
state->AddCommand(new cmGetTestPropertyCommand);
|
||||||
commands.push_back(new cmGetTargetPropertyCommand);
|
state->AddCommand(new cmIncludeDirectoryCommand);
|
||||||
commands.push_back(new cmGetTestPropertyCommand);
|
state->AddCommand(new cmIncludeRegularExpressionCommand);
|
||||||
commands.push_back(new cmIncludeDirectoryCommand);
|
state->AddCommand(new cmInstallCommand);
|
||||||
commands.push_back(new cmIncludeRegularExpressionCommand);
|
state->AddCommand(new cmInstallFilesCommand);
|
||||||
commands.push_back(new cmInstallCommand);
|
state->AddCommand(new cmInstallTargetsCommand);
|
||||||
commands.push_back(new cmInstallFilesCommand);
|
state->AddCommand(new cmLinkDirectoriesCommand);
|
||||||
commands.push_back(new cmInstallTargetsCommand);
|
state->AddCommand(new cmProjectCommand);
|
||||||
commands.push_back(new cmLinkDirectoriesCommand);
|
state->AddCommand(new cmSetSourceFilesPropertiesCommand);
|
||||||
commands.push_back(new cmProjectCommand);
|
state->AddCommand(new cmSetTargetPropertiesCommand);
|
||||||
commands.push_back(new cmSetSourceFilesPropertiesCommand);
|
state->AddCommand(new cmSetTestsPropertiesCommand);
|
||||||
commands.push_back(new cmSetTargetPropertiesCommand);
|
state->AddCommand(new cmSubdirCommand);
|
||||||
commands.push_back(new cmSetTestsPropertiesCommand);
|
state->AddCommand(new cmTargetLinkLibrariesCommand);
|
||||||
commands.push_back(new cmSubdirCommand);
|
state->AddCommand(new cmTryCompileCommand);
|
||||||
commands.push_back(new cmTargetLinkLibrariesCommand);
|
state->AddCommand(new cmTryRunCommand);
|
||||||
commands.push_back(new cmTryCompileCommand);
|
|
||||||
commands.push_back(new cmTryRunCommand);
|
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
commands.push_back(new cmAddCompileOptionsCommand);
|
state->AddCommand(new cmAddCompileOptionsCommand);
|
||||||
commands.push_back(new cmAuxSourceDirectoryCommand);
|
state->AddCommand(new cmAuxSourceDirectoryCommand);
|
||||||
commands.push_back(new cmExportCommand);
|
state->AddCommand(new cmExportCommand);
|
||||||
commands.push_back(new cmFLTKWrapUICommand);
|
state->AddCommand(new cmFLTKWrapUICommand);
|
||||||
commands.push_back(new cmIncludeExternalMSProjectCommand);
|
state->AddCommand(new cmIncludeExternalMSProjectCommand);
|
||||||
commands.push_back(new cmInstallProgramsCommand);
|
state->AddCommand(new cmInstallProgramsCommand);
|
||||||
commands.push_back(new cmLinkLibrariesCommand);
|
state->AddCommand(new cmLinkLibrariesCommand);
|
||||||
commands.push_back(new cmLoadCacheCommand);
|
state->AddCommand(new cmLoadCacheCommand);
|
||||||
commands.push_back(new cmQTWrapCPPCommand);
|
state->AddCommand(new cmQTWrapCPPCommand);
|
||||||
commands.push_back(new cmQTWrapUICommand);
|
state->AddCommand(new cmQTWrapUICommand);
|
||||||
commands.push_back(new cmRemoveDefinitionsCommand);
|
state->AddCommand(new cmRemoveDefinitionsCommand);
|
||||||
commands.push_back(new cmSourceGroupCommand);
|
state->AddCommand(new cmSourceGroupCommand);
|
||||||
commands.push_back(new cmTargetCompileDefinitionsCommand);
|
state->AddCommand(new cmTargetCompileDefinitionsCommand);
|
||||||
commands.push_back(new cmTargetCompileFeaturesCommand);
|
state->AddCommand(new cmTargetCompileFeaturesCommand);
|
||||||
commands.push_back(new cmTargetCompileOptionsCommand);
|
state->AddCommand(new cmTargetCompileOptionsCommand);
|
||||||
commands.push_back(new cmTargetIncludeDirectoriesCommand);
|
state->AddCommand(new cmTargetIncludeDirectoriesCommand);
|
||||||
commands.push_back(new cmTargetSourcesCommand);
|
state->AddCommand(new cmTargetSourcesCommand);
|
||||||
|
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
|
new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
|
||||||
"The export_library_dependencies command should not be called; "
|
"The export_library_dependencies command should not be called; "
|
||||||
"see CMP0033."));
|
"see CMP0033."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmLoadCommandCommand, cmPolicies::CMP0031,
|
new cmLoadCommandCommand, cmPolicies::CMP0031,
|
||||||
"The load_command command should not be called; see CMP0031."));
|
"The load_command command should not be called; see CMP0031."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
|
new cmOutputRequiredFilesCommand, cmPolicies::CMP0032,
|
||||||
"The output_required_files command should not be called; "
|
"The output_required_files command should not be called; "
|
||||||
"see CMP0032."));
|
"see CMP0032."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmSubdirDependsCommand, cmPolicies::CMP0029,
|
new cmSubdirDependsCommand, cmPolicies::CMP0029,
|
||||||
"The subdir_depends command should not be called; see CMP0029."));
|
"The subdir_depends command should not be called; see CMP0029."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmUtilitySourceCommand, cmPolicies::CMP0034,
|
new cmUtilitySourceCommand, cmPolicies::CMP0034,
|
||||||
"The utility_source command should not be called; see CMP0034."));
|
"The utility_source command should not be called; see CMP0034."));
|
||||||
commands.push_back(new cmDisallowedCommand(
|
state->AddCommand(new cmDisallowedCommand(
|
||||||
new cmVariableRequiresCommand, cmPolicies::CMP0035,
|
new cmVariableRequiresCommand, cmPolicies::CMP0035,
|
||||||
"The variable_requires command should not be called; see CMP0035."));
|
"The variable_requires command should not be called; see CMP0035."));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return commands;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-7
@@ -3,17 +3,14 @@
|
|||||||
#ifndef cmCommands_h
|
#ifndef cmCommands_h
|
||||||
#define cmCommands_h
|
#define cmCommands_h
|
||||||
|
|
||||||
#include <cmConfigure.h> // IWYU pragma: keep
|
class cmState;
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class cmCommand;
|
|
||||||
/**
|
/**
|
||||||
* Global function to return all compiled in commands.
|
* Global function to register all compiled in commands.
|
||||||
* To add a new command edit cmCommands.cxx and add your command.
|
* To add a new command edit cmCommands.cxx and add your command.
|
||||||
* It is up to the caller to delete the commands created by this call.
|
* It is up to the caller to delete the commands created by this call.
|
||||||
*/
|
*/
|
||||||
std::vector<cmCommand*> GetScriptingCommands();
|
void GetScriptingCommands(cmState* state);
|
||||||
std::vector<cmCommand*> GetProjectCommands();
|
void GetProjectCommands(cmState* state);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-12
@@ -120,8 +120,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
class cmCommand;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
@@ -1657,20 +1655,12 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
|
|||||||
|
|
||||||
void cmake::AddScriptingCommands()
|
void cmake::AddScriptingCommands()
|
||||||
{
|
{
|
||||||
std::vector<cmCommand*> const commands = GetScriptingCommands();
|
GetScriptingCommands(this->State);
|
||||||
for (std::vector<cmCommand*>::const_iterator i = commands.begin();
|
|
||||||
i != commands.end(); ++i) {
|
|
||||||
this->State->AddCommand(*i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::AddProjectCommands()
|
void cmake::AddProjectCommands()
|
||||||
{
|
{
|
||||||
std::vector<cmCommand*> const commands = GetProjectCommands();
|
GetProjectCommands(this->State);
|
||||||
for (std::vector<cmCommand*>::const_iterator i = commands.begin();
|
|
||||||
i != commands.end(); ++i) {
|
|
||||||
this->State->AddCommand(*i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::AddDefaultGenerators()
|
void cmake::AddDefaultGenerators()
|
||||||
|
|||||||
Reference in New Issue
Block a user