split Default commands into Scripting and Project

This commit is contained in:
Daniel Pfeifer
2017-01-20 22:12:32 +01:00
parent 7fb14775a3
commit 72dcbbe5c0
5 changed files with 152 additions and 118 deletions

View File

@@ -7,10 +7,64 @@ cmake-commands(7)
.. contents::
Normal Commands
===============
Scripting Commands
==================
These commands may be used freely in CMake projects.
These commands are always available.
.. toctree::
:maxdepth: 1
/command/break
/command/cmake_host_system_information
/command/cmake_minimum_required
/command/cmake_parse_arguments
/command/cmake_policy
/command/configure_file
/command/continue
/command/elseif
/command/else
/command/endforeach
/command/endfunction
/command/endif
/command/endmacro
/command/endwhile
/command/execute_process
/command/file
/command/find_file
/command/find_library
/command/find_package
/command/find_path
/command/find_program
/command/foreach
/command/function
/command/get_cmake_property
/command/get_directory_property
/command/get_filename_component
/command/get_property
/command/if
/command/include
/command/list
/command/macro
/command/mark_as_advanced
/command/math
/command/message
/command/option
/command/return
/command/separate_arguments
/command/set_directory_properties
/command/set_property
/command/set
/command/site_name
/command/string
/command/unset
/command/variable_watch
/command/while
Project Commands
================
These commands are available only in CMake projects.
.. toctree::
:maxdepth: 1
@@ -25,73 +79,31 @@ These commands may be used freely in CMake projects.
/command/add_subdirectory
/command/add_test
/command/aux_source_directory
/command/break
/command/build_command
/command/cmake_host_system_information
/command/cmake_minimum_required
/command/cmake_parse_arguments
/command/cmake_policy
/command/configure_file
/command/continue
/command/create_test_sourcelist
/command/define_property
/command/elseif
/command/else
/command/enable_language
/command/enable_testing
/command/endforeach
/command/endfunction
/command/endif
/command/endmacro
/command/endwhile
/command/execute_process
/command/export
/command/file
/command/find_file
/command/find_library
/command/find_package
/command/find_path
/command/find_program
/command/fltk_wrap_ui
/command/foreach
/command/function
/command/get_cmake_property
/command/get_directory_property
/command/get_filename_component
/command/get_property
/command/get_source_file_property
/command/get_target_property
/command/get_test_property
/command/if
/command/include_directories
/command/include_external_msproject
/command/include_regular_expression
/command/include
/command/install
/command/link_directories
/command/link_libraries
/command/list
/command/load_cache
/command/macro
/command/mark_as_advanced
/command/math
/command/message
/command/option
/command/project
/command/qt_wrap_cpp
/command/qt_wrap_ui
/command/remove_definitions
/command/return
/command/separate_arguments
/command/set_directory_properties
/command/set_property
/command/set
/command/set_source_files_properties
/command/set_target_properties
/command/set_tests_properties
/command/site_name
/command/source_group
/command/string
/command/target_compile_definitions
/command/target_compile_features
/command/target_compile_options
@@ -100,9 +112,30 @@ These commands may be used freely in CMake projects.
/command/target_sources
/command/try_compile
/command/try_run
/command/unset
/command/variable_watch
/command/while
.. _`CTest Commands`:
CTest Commands
==============
These commands are available only in CTest scripts.
.. toctree::
:maxdepth: 1
/command/ctest_build
/command/ctest_configure
/command/ctest_coverage
/command/ctest_empty_binary_directory
/command/ctest_memcheck
/command/ctest_read_custom_files
/command/ctest_run_script
/command/ctest_sleep
/command/ctest_start
/command/ctest_submit
/command/ctest_test
/command/ctest_update
/command/ctest_upload
Deprecated Commands
===================
@@ -129,27 +162,3 @@ versions of CMake. Do not use them in new code.
/command/utility_source
/command/variable_requires
/command/write_file
.. _`CTest Commands`:
CTest Commands
==============
These commands are available only in ctest scripts.
.. toctree::
:maxdepth: 1
/command/ctest_build
/command/ctest_configure
/command/ctest_coverage
/command/ctest_empty_binary_directory
/command/ctest_memcheck
/command/ctest_read_custom_files
/command/ctest_run_script
/command/ctest_sleep
/command/ctest_start
/command/ctest_submit
/command/ctest_test
/command/ctest_update
/command/ctest_upload

View File

@@ -105,28 +105,15 @@
#include "cmWriteFileCommand.h"
#endif
std::vector<cmCommand*> GetPredefinedCommands()
std::vector<cmCommand*> GetScriptingCommands()
{
std::vector<cmCommand*> commands;
commands.push_back(new cmAddCustomCommandCommand);
commands.push_back(new cmAddCustomTargetCommand);
commands.push_back(new cmAddDefinitionsCommand);
commands.push_back(new cmAddDependenciesCommand);
commands.push_back(new cmAddExecutableCommand);
commands.push_back(new cmAddLibraryCommand);
commands.push_back(new cmAddSubDirectoryCommand);
commands.push_back(new cmAddTestCommand);
commands.push_back(new cmBreakCommand);
commands.push_back(new cmBuildCommand);
commands.push_back(new cmCMakeMinimumRequired);
commands.push_back(new cmCMakePolicyCommand);
commands.push_back(new cmConfigureFileCommand);
commands.push_back(new cmContinueCommand);
commands.push_back(new cmCreateTestSourceList);
commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEnableTestingCommand);
commands.push_back(new cmExecProgramCommand);
commands.push_back(new cmExecuteProcessCommand);
commands.push_back(new cmFileCommand);
@@ -141,17 +128,8 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmGetDirectoryPropertyCommand);
commands.push_back(new cmGetFilenameComponentCommand);
commands.push_back(new cmGetPropertyCommand);
commands.push_back(new cmGetSourceFilePropertyCommand);
commands.push_back(new cmGetTargetPropertyCommand);
commands.push_back(new cmGetTestPropertyCommand);
commands.push_back(new cmIfCommand);
commands.push_back(new cmIncludeCommand);
commands.push_back(new cmIncludeDirectoryCommand);
commands.push_back(new cmIncludeRegularExpressionCommand);
commands.push_back(new cmInstallCommand);
commands.push_back(new cmInstallFilesCommand);
commands.push_back(new cmInstallTargetsCommand);
commands.push_back(new cmLinkDirectoriesCommand);
commands.push_back(new cmListCommand);
commands.push_back(new cmMacroCommand);
commands.push_back(new cmMakeDirectoryCommand);
@@ -160,21 +138,13 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmMessageCommand);
commands.push_back(new cmOptionCommand);
commands.push_back(new cmParseArgumentsCommand);
commands.push_back(new cmProjectCommand);
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 cmSetSourceFilesPropertiesCommand);
commands.push_back(new cmSetTargetPropertiesCommand);
commands.push_back(new cmSetTestsPropertiesCommand);
commands.push_back(new cmSiteNameCommand);
commands.push_back(new cmStringCommand);
commands.push_back(new cmSubdirCommand);
commands.push_back(new cmTargetLinkLibrariesCommand);
commands.push_back(new cmTryCompileCommand);
commands.push_back(new cmTryRunCommand);
commands.push_back(new cmUnsetCommand);
commands.push_back(new cmWhileCommand);
@@ -206,10 +176,62 @@ std::vector<cmCommand*> GetPredefinedCommands()
"WHILE ENDWHILE structure. Or its arguments did not "
"match the opening WHILE command."));
#if defined(CMAKE_BUILD_WITH_CMAKE)
commands.push_back(new cmCMakeHostSystemInformationCommand);
commands.push_back(new cmRemoveCommand);
commands.push_back(new cmVariableWatchCommand);
commands.push_back(new cmWriteFileCommand);
commands.push_back(new cmDisallowedCommand(
new cmBuildNameCommand, cmPolicies::CMP0036,
"The build_name command should not be called; see CMP0036."));
commands.push_back(new cmDisallowedCommand(
new cmUseMangledMesaCommand, cmPolicies::CMP0030,
"The use_mangled_mesa command should not be called; see CMP0030."));
#endif
return commands;
}
std::vector<cmCommand*> GetProjectCommands()
{
std::vector<cmCommand*> commands;
commands.push_back(new cmAddCustomCommandCommand);
commands.push_back(new cmAddCustomTargetCommand);
commands.push_back(new cmAddDefinitionsCommand);
commands.push_back(new cmAddDependenciesCommand);
commands.push_back(new cmAddExecutableCommand);
commands.push_back(new cmAddLibraryCommand);
commands.push_back(new cmAddSubDirectoryCommand);
commands.push_back(new cmAddTestCommand);
commands.push_back(new cmBuildCommand);
commands.push_back(new cmCreateTestSourceList);
commands.push_back(new cmDefinePropertyCommand);
commands.push_back(new cmEnableLanguageCommand);
commands.push_back(new cmEnableTestingCommand);
commands.push_back(new cmGetSourceFilePropertyCommand);
commands.push_back(new cmGetTargetPropertyCommand);
commands.push_back(new cmGetTestPropertyCommand);
commands.push_back(new cmIncludeDirectoryCommand);
commands.push_back(new cmIncludeRegularExpressionCommand);
commands.push_back(new cmInstallCommand);
commands.push_back(new cmInstallFilesCommand);
commands.push_back(new cmInstallTargetsCommand);
commands.push_back(new cmLinkDirectoriesCommand);
commands.push_back(new cmProjectCommand);
commands.push_back(new cmSetSourceFilesPropertiesCommand);
commands.push_back(new cmSetTargetPropertiesCommand);
commands.push_back(new cmSetTestsPropertiesCommand);
commands.push_back(new cmSubdirCommand);
commands.push_back(new cmTargetLinkLibrariesCommand);
commands.push_back(new cmTryCompileCommand);
commands.push_back(new cmTryRunCommand);
#if defined(CMAKE_BUILD_WITH_CMAKE)
commands.push_back(new cmAddCompileOptionsCommand);
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmCMakeHostSystemInformationCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmFLTKWrapUICommand);
commands.push_back(new cmIncludeExternalMSProjectCommand);
@@ -218,7 +240,6 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmLoadCacheCommand);
commands.push_back(new cmQTWrapCPPCommand);
commands.push_back(new cmQTWrapUICommand);
commands.push_back(new cmRemoveCommand);
commands.push_back(new cmRemoveDefinitionsCommand);
commands.push_back(new cmSourceGroupCommand);
commands.push_back(new cmTargetCompileDefinitionsCommand);
@@ -226,12 +247,7 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmTargetCompileOptionsCommand);
commands.push_back(new cmTargetIncludeDirectoriesCommand);
commands.push_back(new cmTargetSourcesCommand);
commands.push_back(new cmVariableWatchCommand);
commands.push_back(new cmWriteFileCommand);
commands.push_back(new cmDisallowedCommand(
new cmBuildNameCommand, cmPolicies::CMP0036,
"The build_name command should not be called; see CMP0036."));
commands.push_back(new cmDisallowedCommand(
new cmExportLibraryDependenciesCommand, cmPolicies::CMP0033,
"The export_library_dependencies command should not be called; "
@@ -246,9 +262,6 @@ std::vector<cmCommand*> GetPredefinedCommands()
commands.push_back(new cmDisallowedCommand(
new cmSubdirDependsCommand, cmPolicies::CMP0029,
"The subdir_depends command should not be called; see CMP0029."));
commands.push_back(new cmDisallowedCommand(
new cmUseMangledMesaCommand, cmPolicies::CMP0030,
"The use_mangled_mesa command should not be called; see CMP0030."));
commands.push_back(new cmDisallowedCommand(
new cmUtilitySourceCommand, cmPolicies::CMP0034,
"The utility_source command should not be called; see CMP0034."));

View File

@@ -13,6 +13,7 @@ class cmCommand;
* 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.
*/
std::vector<cmCommand*> GetPredefinedCommands();
std::vector<cmCommand*> GetScriptingCommands();
std::vector<cmCommand*> GetProjectCommands();
#endif

View File

@@ -179,7 +179,8 @@ cmake::cmake()
this->AddDefaultGenerators();
this->AddDefaultExtraGenerators();
this->AddDefaultCommands();
this->AddScriptingCommands();
this->AddProjectCommands();
// Make sure we can capture the build tool output.
cmSystemTools::EnableVSConsoleOutput();
@@ -1654,9 +1655,18 @@ const char* cmake::GetCacheDefinition(const std::string& name) const
return this->State->GetInitializedCacheValue(name);
}
void cmake::AddDefaultCommands()
void cmake::AddScriptingCommands()
{
std::vector<cmCommand*> const commands = GetPredefinedCommands();
std::vector<cmCommand*> const commands = GetScriptingCommands();
for (std::vector<cmCommand*>::const_iterator i = commands.begin();
i != commands.end(); ++i) {
this->State->AddCommand(*i);
}
}
void cmake::AddProjectCommands()
{
std::vector<cmCommand*> const commands = GetProjectCommands();
for (std::vector<cmCommand*>::const_iterator i = commands.begin();
i != commands.end(); ++i) {
this->State->AddCommand(*i);

View File

@@ -425,7 +425,8 @@ protected:
typedef std::vector<cmExternalMakefileProjectGeneratorFactory*>
RegisteredExtraGeneratorsVector;
RegisteredExtraGeneratorsVector ExtraGenerators;
void AddDefaultCommands();
void AddScriptingCommands();
void AddProjectCommands();
void AddDefaultGenerators();
void AddDefaultExtraGenerators();