summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-13 13:52:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-13 13:52:34 (GMT)
commitbacb50afa9ed7806a8900ab7524f2f4a4cd7d669 (patch)
tree75fb21b14c4ed42cdca1d9adfc3dad6e38f88927 /Source
parent729c928c7b59919a9d379891973bda22665c75da (diff)
parenta81e9a0ced25490d1384316834dff36a55d4e864 (diff)
downloadCMake-bacb50afa9ed7806a8900ab7524f2f4a4cd7d669.zip
CMake-bacb50afa9ed7806a8900ab7524f2f4a4cd7d669.tar.gz
CMake-bacb50afa9ed7806a8900ab7524f2f4a4cd7d669.tar.bz2
Merge topic 'free-free-set-them-free'
a81e9a0ced cmSubdirCommand: Port away from cmCommand 573cd4e4b4 cmSetTestsPropertiesCommand: Port away from cmCommand 95f23ea5d5 cmSetSourceFilesPropertiesCommand: Port away from cmCommand 706400d417 cmRemoveDefinitionsCommand: Port away from cmCommand 7f86990262 cmQTWrapUICommand: Port away from cmCommand 56bfb8de5d cmQTWrapCPPCommand: Port away from cmCommand 83b3f76a3b cmLinkLibrariesCommand: Port away from cmCommand b85407ae76 cmInstallTargetsCommand: Port away from cmCommand ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3807
Diffstat (limited to 'Source')
-rw-r--r--Source/cmBuildCommand.cxx75
-rw-r--r--Source/cmBuildCommand.h42
-rw-r--r--Source/cmCommands.cxx61
-rw-r--r--Source/cmCreateTestSourceList.cxx39
-rw-r--r--Source/cmCreateTestSourceList.h29
-rw-r--r--Source/cmDefinePropertyCommand.cxx51
-rw-r--r--Source/cmDefinePropertyCommand.h26
-rw-r--r--Source/cmEnableLanguageCommand.cxx17
-rw-r--r--Source/cmEnableLanguageCommand.h32
-rw-r--r--Source/cmFLTKWrapUICommand.cxx39
-rw-r--r--Source/cmFLTKWrapUICommand.h30
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx19
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h21
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx26
-rw-r--r--Source/cmGetTargetPropertyCommand.h21
-rw-r--r--Source/cmGetTestPropertyCommand.cxx17
-rw-r--r--Source/cmGetTestPropertyCommand.h21
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx32
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h31
-rw-r--r--Source/cmIncludeRegularExpressionCommand.cxx18
-rw-r--r--Source/cmIncludeRegularExpressionCommand.h30
-rw-r--r--Source/cmInstallFilesCommand.cxx23
-rw-r--r--Source/cmInstallFilesCommand.h30
-rw-r--r--Source/cmInstallProgramsCommand.cxx20
-rw-r--r--Source/cmInstallProgramsCommand.h30
-rw-r--r--Source/cmInstallTargetsCommand.cxx26
-rw-r--r--Source/cmInstallTargetsCommand.h31
-rw-r--r--Source/cmLinkLibrariesCommand.cxx23
-rw-r--r--Source/cmLinkLibrariesCommand.h31
-rw-r--r--Source/cmQTWrapCPPCommand.cxx41
-rw-r--r--Source/cmQTWrapCPPCommand.h30
-rw-r--r--Source/cmQTWrapUICommand.cxx63
-rw-r--r--Source/cmQTWrapUICommand.h29
-rw-r--r--Source/cmRemoveDefinitionsCommand.cxx16
-rw-r--r--Source/cmRemoveDefinitionsCommand.h31
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx35
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h29
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx31
-rw-r--r--Source/cmSetTestsPropertiesCommand.h26
-rw-r--r--Source/cmSubdirCommand.cxx28
-rw-r--r--Source/cmSubdirCommand.h31
41 files changed, 373 insertions, 908 deletions
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index e9e1d49..49c9439 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -2,32 +2,21 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmBuildCommand.h"
-#include <sstream>
-
+#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-bool cmBuildCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
-{
- // Support the legacy signature of the command:
- //
- if (2 == args.size()) {
- return this->TwoArgsSignature(args);
- }
-
- return this->MainSignature(args);
-}
+namespace {
-bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
+bool MainSignature(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("requires at least one argument naming a CMake variable");
+ status.SetError("requires at least one argument naming a CMake variable");
return false;
}
@@ -63,9 +52,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
doing = DoingNone;
target = args[i];
} else {
- std::ostringstream e;
- e << "unknown argument \"" << args[i] << "\"";
- this->SetError(e.str());
+ status.SetError(cmStrCat("unknown argument \"", args[i], "\""));
return false;
}
}
@@ -82,30 +69,32 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
configuration = "Release";
}
+ cmMakefile& mf = status.GetMakefile();
if (!project_name.empty()) {
- this->Makefile->IssueMessage(
- MessageType::AUTHOR_WARNING,
- "Ignoring PROJECT_NAME option because it has no effect.");
+ mf.IssueMessage(MessageType::AUTHOR_WARNING,
+ "Ignoring PROJECT_NAME option because it has no effect.");
}
- std::string makecommand =
- this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
- target, configuration, "", this->Makefile->IgnoreErrorsCMP0061());
+ std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
+ target, configuration, "", mf.IgnoreErrorsCMP0061());
- this->Makefile->AddDefinition(variable, makecommand);
+ mf.AddDefinition(variable, makecommand);
return true;
}
-bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
+bool TwoArgsSignature(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with less than two arguments");
+ status.SetError("called with less than two arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
std::string const& define = args[0];
- const char* cacheValue = this->Makefile->GetDefinition(define);
+ const char* cacheValue = mf.GetDefinition(define);
std::string configType;
if (!cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE", configType) ||
@@ -113,16 +102,28 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
configType = "Release";
}
- std::string makecommand =
- this->Makefile->GetGlobalGenerator()->GenerateCMakeBuildCommand(
- "", configType, "", this->Makefile->IgnoreErrorsCMP0061());
+ std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
+ "", configType, "", mf.IgnoreErrorsCMP0061());
if (cacheValue) {
return true;
}
- this->Makefile->AddCacheDefinition(define, makecommand.c_str(),
- "Command used to build entire project "
- "from the command line.",
- cmStateEnums::STRING);
+ mf.AddCacheDefinition(define, makecommand.c_str(),
+ "Command used to build entire project "
+ "from the command line.",
+ cmStateEnums::STRING);
return true;
}
+
+} // namespace
+
+bool cmBuildCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ // Support the legacy signature of the command:
+ if (args.size() == 2) {
+ return TwoArgsSignature(args, status);
+ }
+
+ return MainSignature(args, status);
+}
diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h
index d373103..45aa71d 100644
--- a/Source/cmBuildCommand.h
+++ b/Source/cmBuildCommand.h
@@ -8,47 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmBuildCommand
- * \brief build_command command
- *
- * cmBuildCommand implements the build_command CMake command
- */
-class cmBuildCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmBuildCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
- /**
- * The primary command signature with optional, KEYWORD-based args.
- */
- virtual bool MainSignature(std::vector<std::string> const& args);
-
- /**
- * Legacy "exactly 2 args required" signature.
- */
- virtual bool TwoArgsSignature(std::vector<std::string> const& args);
-
-private:
- bool IgnoreErrors() const;
-};
+bool cmBuildCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index dfe130e..38fcf5b 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -222,41 +222,32 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("add_library", cmAddLibraryCommand);
state->AddBuiltinCommand("add_subdirectory", cmAddSubDirectoryCommand);
state->AddBuiltinCommand("add_test", cmAddTestCommand);
- state->AddBuiltinCommand("build_command", cm::make_unique<cmBuildCommand>());
- state->AddBuiltinCommand("create_test_sourcelist",
- cm::make_unique<cmCreateTestSourceList>());
- state->AddBuiltinCommand("define_property",
- cm::make_unique<cmDefinePropertyCommand>());
- state->AddBuiltinCommand("enable_language",
- cm::make_unique<cmEnableLanguageCommand>());
+ state->AddBuiltinCommand("build_command", cmBuildCommand);
+ state->AddBuiltinCommand("create_test_sourcelist", cmCreateTestSourceList);
+ state->AddBuiltinCommand("define_property", cmDefinePropertyCommand);
+ state->AddBuiltinCommand("enable_language", cmEnableLanguageCommand);
state->AddBuiltinCommand("enable_testing", cmEnableTestingCommand);
state->AddBuiltinCommand("get_source_file_property",
- cm::make_unique<cmGetSourceFilePropertyCommand>());
- state->AddBuiltinCommand("get_target_property",
- cm::make_unique<cmGetTargetPropertyCommand>());
- state->AddBuiltinCommand("get_test_property",
- cm::make_unique<cmGetTestPropertyCommand>());
+ cmGetSourceFilePropertyCommand);
+ state->AddBuiltinCommand("get_target_property", cmGetTargetPropertyCommand);
+ state->AddBuiltinCommand("get_test_property", cmGetTestPropertyCommand);
state->AddBuiltinCommand("include_directories",
cm::make_unique<cmIncludeDirectoryCommand>());
- state->AddBuiltinCommand(
- "include_regular_expression",
- cm::make_unique<cmIncludeRegularExpressionCommand>());
+ state->AddBuiltinCommand("include_regular_expression",
+ cmIncludeRegularExpressionCommand);
state->AddBuiltinCommand("install", cm::make_unique<cmInstallCommand>());
- state->AddBuiltinCommand("install_files",
- cm::make_unique<cmInstallFilesCommand>());
- state->AddBuiltinCommand("install_targets",
- cm::make_unique<cmInstallTargetsCommand>());
+ state->AddBuiltinCommand("install_files", cmInstallFilesCommand);
+ state->AddBuiltinCommand("install_targets", cmInstallTargetsCommand);
state->AddBuiltinCommand("link_directories",
cm::make_unique<cmLinkDirectoriesCommand>());
state->AddBuiltinCommand("project", cm::make_unique<cmProjectCommand>());
- state->AddBuiltinCommand(
- "set_source_files_properties",
- cm::make_unique<cmSetSourceFilesPropertiesCommand>());
+ state->AddBuiltinCommand("set_source_files_properties",
+ cmSetSourceFilesPropertiesCommand);
state->AddBuiltinCommand("set_target_properties",
cm::make_unique<cmSetTargetPropertiesCommand>());
state->AddBuiltinCommand("set_tests_properties",
- cm::make_unique<cmSetTestsPropertiesCommand>());
- state->AddBuiltinCommand("subdirs", cm::make_unique<cmSubdirCommand>());
+ cmSetTestsPropertiesCommand);
+ state->AddBuiltinCommand("subdirs", cmSubdirCommand);
state->AddBuiltinCommand(
"target_compile_definitions",
cm::make_unique<cmTargetCompileDefinitionsCommand>());
@@ -285,27 +276,21 @@ void GetProjectCommands(cmState* state)
state->AddBuiltinCommand("aux_source_directory",
cmAuxSourceDirectoryCommand);
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
- state->AddBuiltinCommand("fltk_wrap_ui",
- cm::make_unique<cmFLTKWrapUICommand>());
- state->AddBuiltinCommand(
- "include_external_msproject",
- cm::make_unique<cmIncludeExternalMSProjectCommand>());
- state->AddBuiltinCommand("install_programs",
- cm::make_unique<cmInstallProgramsCommand>());
+ state->AddBuiltinCommand("fltk_wrap_ui", cmFLTKWrapUICommand);
+ state->AddBuiltinCommand("include_external_msproject",
+ cmIncludeExternalMSProjectCommand);
+ state->AddBuiltinCommand("install_programs", cmInstallProgramsCommand);
state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
- state->AddBuiltinCommand("link_libraries",
- cm::make_unique<cmLinkLibrariesCommand>());
+ state->AddBuiltinCommand("link_libraries", cmLinkLibrariesCommand);
state->AddBuiltinCommand("target_link_options",
cm::make_unique<cmTargetLinkOptionsCommand>());
state->AddBuiltinCommand("target_link_directories",
cm::make_unique<cmTargetLinkDirectoriesCommand>());
state->AddBuiltinCommand("load_cache",
cm::make_unique<cmLoadCacheCommand>());
- state->AddBuiltinCommand("qt_wrap_cpp",
- cm::make_unique<cmQTWrapCPPCommand>());
- state->AddBuiltinCommand("qt_wrap_ui", cm::make_unique<cmQTWrapUICommand>());
- state->AddBuiltinCommand("remove_definitions",
- cm::make_unique<cmRemoveDefinitionsCommand>());
+ state->AddBuiltinCommand("qt_wrap_cpp", cmQTWrapCPPCommand);
+ state->AddBuiltinCommand("qt_wrap_ui", cmQTWrapUICommand);
+ state->AddBuiltinCommand("remove_definitions", cmRemoveDefinitionsCommand);
state->AddBuiltinCommand("source_group",
cm::make_unique<cmSourceGroupCommand>());
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index da23519..9d492ba 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -4,19 +4,17 @@
#include <algorithm>
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmCreateTestSourceList
-bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmCreateTestSourceList(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 3) {
- this->SetError("called with wrong number of arguments.");
+ status.SetError("called with wrong number of arguments.");
return false;
}
@@ -29,14 +27,14 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
if (*i == "EXTRA_INCLUDE") {
++i;
if (i == args.end()) {
- this->SetError("incorrect arguments to EXTRA_INCLUDE");
+ status.SetError("incorrect arguments to EXTRA_INCLUDE");
return false;
}
extraInclude = cmStrCat("#include \"", *i, "\"\n");
} else if (*i == "FUNCTION") {
++i;
if (i == args.end()) {
- this->SetError("incorrect arguments to FUNCTION");
+ status.SetError("incorrect arguments to FUNCTION");
return false;
}
function = cmStrCat(*i, "(&ac, &av);\n");
@@ -54,12 +52,12 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
// Name of the test driver
// make sure they specified an extension
if (cmSystemTools::GetFilenameExtension(*i).size() < 2) {
- this->SetError(
+ status.SetError(
"You must specify a file extension for the test driver file.");
return false;
}
- std::string driver =
- cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', *i);
+ cmMakefile& mf = status.GetMakefile();
+ std::string driver = cmStrCat(mf.GetCurrentBinaryDirectory(), '/', *i);
++i;
std::string configFile = cmSystemTools::GetCMakeRoot();
@@ -121,35 +119,32 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
numTests++;
}
if (!extraInclude.empty()) {
- this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
- extraInclude);
+ mf.AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES", extraInclude);
}
if (!function.empty()) {
- this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function);
+ mf.AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION", function);
}
- this->Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS",
- forwardDeclareCode);
- this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
- functionMapCode);
+ mf.AddDefinition("CMAKE_FORWARD_DECLARE_TESTS", forwardDeclareCode);
+ mf.AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", functionMapCode);
bool res = true;
- if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) {
+ if (!mf.ConfigureFile(configFile, driver, false, true, false)) {
res = false;
}
// Construct the source list.
std::string sourceListValue;
{
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(driver);
+ cmSourceFile* sf = mf.GetOrCreateSource(driver);
sf->SetProperty("ABSTRACT", "0");
sourceListValue = args[1];
}
for (i = testsBegin; i != tests.end(); ++i) {
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
+ cmSourceFile* sf = mf.GetOrCreateSource(*i);
sf->SetProperty("ABSTRACT", "0");
sourceListValue += ";";
sourceListValue += *i;
}
- this->Makefile->AddDefinition(sourceList, sourceListValue);
+ mf.AddDefinition(sourceList, sourceListValue);
return res;
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 5aa6af4..19503f4 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -8,34 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmCreateTestSourceList
- * \brief Test driver generation command
- *
- */
-
-class cmCreateTestSourceList : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmCreateTestSourceList>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmCreateTestSourceList(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 86a83da..f4e4fda 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -2,19 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDefinePropertyCommand.h"
-#include <sstream>
-
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
+#include "cmStringAlgorithms.h"
-class cmExecutionStatus;
-
-bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmDefinePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
@@ -37,17 +35,17 @@ bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
} else if (scope_arg == "CACHED_VARIABLE") {
scope = cmProperty::CACHED_VARIABLE;
} else {
- std::ostringstream e;
- e << "given invalid scope " << scope_arg << ". "
- << "Valid scopes are "
- << "GLOBAL, DIRECTORY, TARGET, SOURCE, "
- << "TEST, VARIABLE, CACHED_VARIABLE.";
- this->SetError(e.str());
+ status.SetError(cmStrCat("given invalid scope ", scope_arg,
+ ". Valid scopes are GLOBAL, DIRECTORY, TARGET, "
+ "SOURCE, TEST, VARIABLE, CACHED_VARIABLE."));
return false;
}
// Parse remaining arguments.
bool inherited = false;
+ std::string PropertyName;
+ std::string BriefDocs;
+ std::string FullDocs;
enum Doing
{
DoingNone,
@@ -68,39 +66,36 @@ bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
inherited = true;
} else if (doing == DoingProperty) {
doing = DoingNone;
- this->PropertyName = args[i];
+ PropertyName = args[i];
} else if (doing == DoingBrief) {
- this->BriefDocs += args[i];
+ BriefDocs += args[i];
} else if (doing == DoingFull) {
- this->FullDocs += args[i];
+ FullDocs += args[i];
} else {
- std::ostringstream e;
- e << "given invalid argument \"" << args[i] << "\".";
- this->SetError(e.str());
+ status.SetError(cmStrCat("given invalid argument \"", args[i], "\"."));
return false;
}
}
// Make sure a property name was found.
- if (this->PropertyName.empty()) {
- this->SetError("not given a PROPERTY <name> argument.");
+ if (PropertyName.empty()) {
+ status.SetError("not given a PROPERTY <name> argument.");
return false;
}
// Make sure documentation was given.
- if (this->BriefDocs.empty()) {
- this->SetError("not given a BRIEF_DOCS <brief-doc> argument.");
+ if (BriefDocs.empty()) {
+ status.SetError("not given a BRIEF_DOCS <brief-doc> argument.");
return false;
}
- if (this->FullDocs.empty()) {
- this->SetError("not given a FULL_DOCS <full-doc> argument.");
+ if (FullDocs.empty()) {
+ status.SetError("not given a FULL_DOCS <full-doc> argument.");
return false;
}
// Actually define the property.
- this->Makefile->GetState()->DefineProperty(
- this->PropertyName, scope, this->BriefDocs.c_str(), this->FullDocs.c_str(),
- inherited);
+ status.GetMakefile().GetState()->DefineProperty(
+ PropertyName, scope, BriefDocs.c_str(), FullDocs.c_str(), inherited);
return true;
}
diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h
index 36f97df..60dd76a 100644
--- a/Source/cmDefinePropertyCommand.h
+++ b/Source/cmDefinePropertyCommand.h
@@ -8,31 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmDefinePropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmDefinePropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-
-private:
- std::string PropertyName;
- std::string BriefDocs;
- std::string FullDocs;
-};
+bool cmDefinePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx
index ddd26de..59522c0 100644
--- a/Source/cmEnableLanguageCommand.cxx
+++ b/Source/cmEnableLanguageCommand.cxx
@@ -2,20 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmEnableLanguageCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmEnableLanguageCommand
-bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmEnableLanguageCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- bool optional = false;
- std::vector<std::string> languages;
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ bool optional = false;
+ std::vector<std::string> languages;
for (std::string const& it : args) {
if (it == "OPTIONAL") {
optional = true;
@@ -24,6 +23,6 @@ bool cmEnableLanguageCommand::InitialPass(std::vector<std::string> const& args,
}
}
- this->Makefile->EnableLanguage(languages, optional);
+ status.GetMakefile().EnableLanguage(languages, optional);
return true;
}
diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h
index dc43e34..1f8c4ce 100644
--- a/Source/cmEnableLanguageCommand.h
+++ b/Source/cmEnableLanguageCommand.h
@@ -8,37 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmEnableLanguageCommand
- * \brief Specify the name for this build project.
- *
- * cmEnableLanguageCommand is used to specify a name for this build project.
- * It is defined once per set of CMakeList.txt files (including
- * all subdirectories). Currently it just sets the name of the workspace
- * file for Microsoft Visual C++
- */
-class cmEnableLanguageCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmEnableLanguageCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmEnableLanguageCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index ea9e672..5094c3c 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -5,13 +5,13 @@
#include <stddef.h>
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
class cmTarget;
static void FinalAction(cmMakefile& makefile, std::string const& name)
@@ -30,39 +30,40 @@ static void FinalAction(cmMakefile& makefile, std::string const& name)
}
}
-// cmFLTKWrapUICommand
-bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// what is the current source dir
- std::string cdir = this->Makefile->GetCurrentSourceDirectory();
+ std::string cdir = mf.GetCurrentSourceDirectory();
std::string const& fluid_exe =
- this->Makefile->GetRequiredDefinition("FLTK_FLUID_EXECUTABLE");
+ mf.GetRequiredDefinition("FLTK_FLUID_EXECUTABLE");
// Target that will use the generated files
std::string const& target = args[0];
// get the list of GUI files from which .cxx and .h will be generated
- std::string outputDirectory = this->Makefile->GetCurrentBinaryDirectory();
+ std::string outputDirectory = mf.GetCurrentBinaryDirectory();
{
// Some of the generated files are *.h so the directory "GUI"
// where they are created have to be added to the include path
std::vector<std::string> outputDirectories;
outputDirectories.push_back(outputDirectory);
- this->Makefile->AddIncludeDirectories(outputDirectories);
+ mf.AddIncludeDirectories(outputDirectories);
}
// List of produced files.
std::vector<cmSourceFile*> generatedSourcesClasses;
for (std::string const& arg : cmMakeRange(args).advance(1)) {
- cmSourceFile* curr = this->Makefile->GetSource(arg);
+ cmSourceFile* curr = mf.GetSource(arg);
// if we should use the source GUI
// to generate .cxx and .h files
if (!curr || !curr->GetPropertyAsBool("WRAP_EXCLUDE")) {
@@ -91,14 +92,12 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
std::string no_main_dependency;
const char* no_comment = nullptr;
const char* no_working_dir = nullptr;
- this->Makefile->AddCustomCommandToOutput(
- cxxres, depends, no_main_dependency, commandLines, no_comment,
- no_working_dir);
- this->Makefile->AddCustomCommandToOutput(
- hname, depends, no_main_dependency, commandLines, no_comment,
- no_working_dir);
-
- cmSourceFile* sf = this->Makefile->GetSource(cxxres);
+ mf.AddCustomCommandToOutput(cxxres, depends, no_main_dependency,
+ commandLines, no_comment, no_working_dir);
+ mf.AddCustomCommandToOutput(hname, depends, no_main_dependency,
+ commandLines, no_comment, no_working_dir);
+
+ cmSourceFile* sf = mf.GetSource(cxxres);
sf->AddDepend(hname);
sf->AddDepend(origname);
generatedSourcesClasses.push_back(sf);
@@ -116,9 +115,9 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args,
}
std::string const varName = target + "_FLTK_UI_SRCS";
- this->Makefile->AddDefinition(varName, sourceListValue);
+ mf.AddDefinition(varName, sourceListValue);
- this->Makefile->AddFinalAction(
+ mf.AddFinalAction(
[target](cmMakefile& makefile) { FinalAction(makefile, target); });
return true;
}
diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h
index ea8d401..bb56dbd 100644
--- a/Source/cmFLTKWrapUICommand.h
+++ b/Source/cmFLTKWrapUICommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmFLTKWrapUICommand
- * \brief Create .h and .cxx files rules for FLTK user interfaces files
- *
- * cmFLTKWrapUICommand is used to create wrappers for FLTK classes into
- * normal C++
- */
-class cmFLTKWrapUICommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmFLTKWrapUICommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 5c1c8a5..eefdc6c 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -2,26 +2,25 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetSourceFilePropertyCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
-class cmExecutionStatus;
-
-// cmSetSourceFilePropertyCommand
-bool cmGetSourceFilePropertyCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 3) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
std::string const& var = args[0];
std::string const& file = args[1];
- cmSourceFile* sf = this->Makefile->GetSource(file);
+ cmMakefile& mf = status.GetMakefile();
+ cmSourceFile* sf = mf.GetSource(file);
// for the location we must create a source file first
if (!sf && args[2] == "LOCATION") {
- sf = this->Makefile->CreateSource(file);
+ sf = mf.CreateSource(file);
}
if (sf) {
const char* prop = nullptr;
@@ -29,11 +28,11 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
prop = sf->GetPropertyForUser(args[2]);
}
if (prop) {
- this->Makefile->AddDefinition(var, prop);
+ mf.AddDefinition(var, prop);
return true;
}
}
- this->Makefile->AddDefinition(var, "NOTFOUND");
+ mf.AddDefinition(var, "NOTFOUND");
return true;
}
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
index 387a7f4..f0c319b 100644
--- a/Source/cmGetSourceFilePropertyCommand.h
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -8,26 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmGetSourceFilePropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmGetSourceFilePropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 07aaf02..7f5df9c 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -4,6 +4,7 @@
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
@@ -11,32 +12,31 @@
#include "cmTarget.h"
#include "cmTargetPropertyComputer.h"
-class cmExecutionStatus;
class cmMessenger;
-// cmSetTargetPropertyCommand
-bool cmGetTargetPropertyCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() != 3) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
std::string const& var = args[0];
std::string const& targetName = args[1];
std::string prop;
bool prop_exists = false;
+ cmMakefile& mf = status.GetMakefile();
- if (cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) {
+ if (cmTarget* tgt = mf.FindTargetToUse(targetName)) {
if (args[2] == "ALIASED_TARGET") {
- if (this->Makefile->IsAlias(targetName)) {
+ if (mf.IsAlias(targetName)) {
prop = tgt->GetName();
prop_exists = true;
}
} else if (!args[2].empty()) {
const char* prop_cstr = nullptr;
- cmListFileBacktrace bt = this->Makefile->GetBacktrace();
- cmMessenger* messenger = this->Makefile->GetMessenger();
+ cmListFileBacktrace bt = mf.GetBacktrace();
+ cmMessenger* messenger = mf.GetMessenger();
if (cmTargetPropertyComputer::PassesWhitelist(tgt->GetType(), args[2],
messenger, bt)) {
prop_cstr = tgt->GetComputedProperty(args[2], messenger, bt);
@@ -53,7 +53,7 @@ bool cmGetTargetPropertyCommand::InitialPass(
bool issueMessage = false;
std::ostringstream e;
MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0045)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0045)) {
case cmPolicies::WARN:
issueMessage = true;
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n";
@@ -68,16 +68,16 @@ bool cmGetTargetPropertyCommand::InitialPass(
if (issueMessage) {
e << "get_target_property() called with non-existent target \""
<< targetName << "\".";
- this->Makefile->IssueMessage(messageType, e.str());
+ mf.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
}
}
if (prop_exists) {
- this->Makefile->AddDefinition(var, prop);
+ mf.AddDefinition(var, prop);
return true;
}
- this->Makefile->AddDefinition(var, var + "-NOTFOUND");
+ mf.AddDefinition(var, var + "-NOTFOUND");
return true;
}
diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h
index 1a53195..c13078f 100644
--- a/Source/cmGetTargetPropertyCommand.h
+++ b/Source/cmGetTargetPropertyCommand.h
@@ -8,26 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmGetTargetPropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmGetTargetPropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index 0b0d6eb..cf8c1d5 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -2,33 +2,32 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetTestPropertyCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmTest.h"
-class cmExecutionStatus;
-
-// cmGetTestPropertyCommand
-bool cmGetTestPropertyCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmGetTestPropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 3) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
std::string const& testName = args[0];
std::string const& var = args[2];
- cmTest* test = this->Makefile->GetTest(testName);
+ cmMakefile& mf = status.GetMakefile();
+ cmTest* test = mf.GetTest(testName);
if (test) {
const char* prop = nullptr;
if (!args[1].empty()) {
prop = test->GetProperty(args[1]);
}
if (prop) {
- this->Makefile->AddDefinition(var, prop);
+ mf.AddDefinition(var, prop);
return true;
}
}
- this->Makefile->AddDefinition(var, "NOTFOUND");
+ mf.AddDefinition(var, "NOTFOUND");
return true;
}
diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h
index a53a7f7..30beb8f 100644
--- a/Source/cmGetTestPropertyCommand.h
+++ b/Source/cmGetTestPropertyCommand.h
@@ -8,26 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmGetTestPropertyCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmGetTestPropertyCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmGetTestPropertyCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx
index 93134ad..fa1e8bc 100644
--- a/Source/cmIncludeExternalMSProjectCommand.cxx
+++ b/Source/cmIncludeExternalMSProjectCommand.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeExternalMSProjectCommand.h"
+#include "cmExecutionStatus.h"
+
#ifdef _WIN32
# include "cmGlobalGenerator.h"
# include "cmMakefile.h"
@@ -11,22 +13,20 @@
# include "cmake.h"
#endif
-class cmExecutionStatus;
-
-// cmIncludeExternalMSProjectCommand
-bool cmIncludeExternalMSProjectCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
- "number of arguments");
+ status.SetError("INCLUDE_EXTERNAL_MSPROJECT called with incorrect "
+ "number of arguments");
return false;
}
+
// only compile this for win32 to avoid coverage errors
#ifdef _WIN32
- if (this->Makefile->GetDefinition("WIN32") ||
- this->Makefile->GetGlobalGenerator()
- ->IsIncludeExternalMSProjectSupported()) {
+ cmMakefile& mf = status.GetMakefile();
+ if (mf.GetDefinition("WIN32") ||
+ mf.GetGlobalGenerator()->IsIncludeExternalMSProjectSupported()) {
enum Doing
{
DoingNone,
@@ -77,15 +77,15 @@ bool cmIncludeExternalMSProjectCommand::InitialPass(
if (!customGuid.empty()) {
std::string guidVariable = utility_name + "_GUID_CMAKE";
- this->Makefile->GetCMakeInstance()->AddCacheEntry(
- guidVariable.c_str(), customGuid.c_str(), "Stored GUID",
- cmStateEnums::INTERNAL);
+ mf.GetCMakeInstance()->AddCacheEntry(guidVariable.c_str(),
+ customGuid.c_str(), "Stored GUID",
+ cmStateEnums::INTERNAL);
}
// Create a target instance for this utility.
- cmTarget* target = this->Makefile->AddNewTarget(cmStateEnums::UTILITY,
- utility_name.c_str());
- if (this->Makefile->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
+ cmTarget* target =
+ mf.AddNewTarget(cmStateEnums::UTILITY, utility_name.c_str());
+ if (mf.GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h
index 9f76576..1013c44 100644
--- a/Source/cmIncludeExternalMSProjectCommand.h
+++ b/Source/cmIncludeExternalMSProjectCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmIncludeExternalMSProjectCommand
- * \brief Specify an external MS project file for inclusion in the workspace.
- *
- * cmIncludeExternalMSProjectCommand is used to specify an externally
- * generated Microsoft project file for inclusion in the default workspace
- * generated by CMake.
- */
-class cmIncludeExternalMSProjectCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmIncludeExternalMSProjectCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx
index 073c95f..655ebd6 100644
--- a/Source/cmIncludeRegularExpressionCommand.cxx
+++ b/Source/cmIncludeRegularExpressionCommand.cxx
@@ -2,22 +2,22 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmIncludeRegularExpressionCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmIncludeRegularExpressionCommand
-bool cmIncludeRegularExpressionCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmIncludeRegularExpressionCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- if ((args.empty()) || (args.size() > 2)) {
- this->SetError("called with incorrect number of arguments");
+ if (args.empty() || args.size() > 2) {
+ status.SetError("called with incorrect number of arguments");
return false;
}
- this->Makefile->SetIncludeRegularExpression(args[0].c_str());
+
+ cmMakefile& mf = status.GetMakefile();
+ mf.SetIncludeRegularExpression(args[0].c_str());
if (args.size() > 1) {
- this->Makefile->SetComplainRegularExpression(args[1]);
+ mf.SetComplainRegularExpression(args[1]);
}
return true;
diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h
index 1723c8b..ca152b0 100644
--- a/Source/cmIncludeRegularExpressionCommand.h
+++ b/Source/cmIncludeRegularExpressionCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmIncludeRegularExpressionCommand
- * \brief Set the regular expression for following #includes.
- *
- * cmIncludeRegularExpressionCommand is used to specify the regular expression
- * that determines whether to follow a #include file in dependency checking.
- */
-class cmIncludeRegularExpressionCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmIncludeRegularExpressionCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmIncludeRegularExpressionCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 4eb5f24..d623943 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallFilesCommand.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -11,8 +12,6 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
static std::string FindInstallSource(cmMakefile& makefile, const char* name);
static void CreateInstallGenerator(cmMakefile& makefile,
std::string const& dest,
@@ -20,16 +19,18 @@ static void CreateInstallGenerator(cmMakefile& makefile,
static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::vector<std::string> const& args);
-bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmInstallFilesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Enable the install target.
- this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
+ mf.GetGlobalGenerator()->EnableInstallTarget();
std::string const& dest = args[0];
@@ -37,18 +38,18 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& args,
std::vector<std::string> files;
for (std::string const& arg : cmMakeRange(args).advance(2)) {
// Find the source location for each file listed.
- files.push_back(FindInstallSource(*this->Makefile, arg.c_str()));
+ files.push_back(FindInstallSource(mf, arg.c_str()));
}
- CreateInstallGenerator(*this->Makefile, dest, files);
+ CreateInstallGenerator(mf, dest, files);
} else {
std::vector<std::string> finalArgs(args.begin() + 1, args.end());
- this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ mf.AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
FinalAction(makefile, dest, finalArgs);
});
}
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ mf.GetGlobalGenerator()->AddInstallComponent(
+ mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index f9b84fd..f4ebbde 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmInstallFilesCommand
- * \brief Specifies where to install some files
- *
- * cmInstallFilesCommand specifies the relative path where a list of
- * files should be installed.
- */
-class cmInstallFilesCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmInstallFilesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmInstallFilesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 31a18b5..6bb4409 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallProgramsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmInstallFilesGenerator.h"
@@ -10,30 +11,29 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::vector<std::string> const& args);
static std::string FindInstallSource(cmMakefile& makefile, const char* name);
-// cmExecutableCommand
-bool cmInstallProgramsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmInstallProgramsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Enable the install target.
- this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
+ mf.GetGlobalGenerator()->EnableInstallTarget();
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ mf.GetGlobalGenerator()->AddInstallComponent(
+ mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
std::string const& dest = args[0];
std::vector<std::string> const finalArgs(args.begin() + 1, args.end());
- this->Makefile->AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
+ mf.AddFinalAction([dest, finalArgs](cmMakefile& makefile) {
FinalAction(makefile, dest, finalArgs);
});
return true;
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index ccd621d..c567f3b 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmInstallProgramsCommand
- * \brief Specifies where to install some programs
- *
- * cmInstallProgramsCommand specifies the relative path where a list of
- * programs should be installed.
- */
-class cmInstallProgramsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmInstallProgramsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmInstallProgramsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx
index 30fd03d..44f23a5 100644
--- a/Source/cmInstallTargetsCommand.cxx
+++ b/Source/cmInstallTargetsCommand.cxx
@@ -5,25 +5,25 @@
#include <unordered_map>
#include <utility>
+#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
-// cmExecutableCommand
-bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmInstallTargetsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Enable the install target.
- this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
+ mf.GetGlobalGenerator()->EnableInstallTarget();
- cmMakefile::cmTargetMap& tgts = this->Makefile->GetTargets();
+ cmMakefile::cmTargetMap& tgts = mf.GetTargets();
auto s = args.begin();
++s;
std::string runtime_dir = "/bin";
@@ -31,8 +31,8 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
if (*s == "RUNTIME_DIRECTORY") {
++s;
if (s == args.end()) {
- this->SetError("called with RUNTIME_DIRECTORY but no actual "
- "directory");
+ status.SetError("called with RUNTIME_DIRECTORY but no actual "
+ "directory");
return false;
}
@@ -45,14 +45,14 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
ti->second.SetHaveInstallRule(true);
} else {
std::string str = "Cannot find target: \"" + *s + "\" to install.";
- this->SetError(str);
+ status.SetError(str);
return false;
}
}
}
- this->Makefile->GetGlobalGenerator()->AddInstallComponent(
- this->Makefile->GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
+ mf.GetGlobalGenerator()->AddInstallComponent(
+ mf.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"));
return true;
}
diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h
index 55e69ba..0c5850c 100644
--- a/Source/cmInstallTargetsCommand.h
+++ b/Source/cmInstallTargetsCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmInstallTargetsCommand
- * \brief Specifies where to install some targets
- *
- * cmInstallTargetsCommand specifies the relative path where a list of
- * targets should be installed. The targets can be executables or
- * libraries.
- */
-class cmInstallTargetsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmInstallTargetsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmInstallTargetsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index bf05310..cb63ceb 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -2,38 +2,37 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkLibrariesCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmLinkLibrariesCommand
-bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmLinkLibrariesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
return true;
}
+ cmMakefile& mf = status.GetMakefile();
// add libraries, note that there is an optional prefix
// of debug and optimized than can be used
for (auto i = args.begin(); i != args.end(); ++i) {
if (*i == "debug") {
++i;
if (i == args.end()) {
- this->SetError("The \"debug\" argument must be followed by "
- "a library");
+ status.SetError("The \"debug\" argument must be followed by "
+ "a library");
return false;
}
- this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
+ mf.AppendProperty("LINK_LIBRARIES", "debug");
} else if (*i == "optimized") {
++i;
if (i == args.end()) {
- this->SetError("The \"optimized\" argument must be followed by "
- "a library");
+ status.SetError("The \"optimized\" argument must be followed by "
+ "a library");
return false;
}
- this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
+ mf.AppendProperty("LINK_LIBRARIES", "optimized");
}
- this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
+ mf.AppendProperty("LINK_LIBRARIES", i->c_str());
}
return true;
diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h
index 484ab0a..3412251 100644
--- a/Source/cmLinkLibrariesCommand.h
+++ b/Source/cmLinkLibrariesCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmLinkLibrariesCommand
- * \brief Specify a list of libraries to link into executables.
- *
- * cmLinkLibrariesCommand is used to specify a list of libraries to link
- * into executable(s) or shared objects. The names of the libraries
- * should be those defined by the LIBRARY(library) command(s).
- */
-class cmLinkLibrariesCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmLinkLibrariesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmLinkLibrariesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index ba82813..1a5602b 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -2,45 +2,44 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapCPPCommand.h"
+#include <utility>
+
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#include <utility>
-
-class cmExecutionStatus;
-
-// cmQTWrapCPPCommand
-bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 3) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Get the moc executable to run in the custom command.
- std::string const& moc_exe =
- this->Makefile->GetRequiredDefinition("QT_MOC_EXECUTABLE");
+ std::string const& moc_exe = mf.GetRequiredDefinition("QT_MOC_EXECUTABLE");
// Get the variable holding the list of sources.
std::string const& sourceList = args[1];
- std::string sourceListValue = this->Makefile->GetSafeDefinition(sourceList);
+ std::string sourceListValue = mf.GetSafeDefinition(sourceList);
// Create a rule for all sources listed.
for (std::string const& arg : cmMakeRange(args).advance(2)) {
- cmSourceFile* curr = this->Makefile->GetSource(arg);
+ cmSourceFile* curr = mf.GetSource(arg);
// if we should wrap the class
if (!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) {
// Compute the name of the file to generate.
std::string srcName =
cmSystemTools::GetFilenameWithoutLastExtension(arg);
- std::string newName = cmStrCat(
- this->Makefile->GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx");
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(newName, true);
+ std::string newName =
+ cmStrCat(mf.GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx");
+ cmSourceFile* sf = mf.GetOrCreateSource(newName, true);
if (curr) {
sf->SetProperty("ABSTRACT", curr->GetProperty("ABSTRACT"));
}
@@ -51,9 +50,9 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
hname = arg;
} else {
if (curr && curr->GetIsGenerated()) {
- hname = this->Makefile->GetCurrentBinaryDirectory();
+ hname = mf.GetCurrentBinaryDirectory();
} else {
- hname = this->Makefile->GetCurrentSourceDirectory();
+ hname = mf.GetCurrentSourceDirectory();
}
hname += "/";
hname += arg;
@@ -81,13 +80,13 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
std::string no_main_dependency;
const char* no_working_dir = nullptr;
- this->Makefile->AddCustomCommandToOutput(
- newName, depends, no_main_dependency, commandLines, "Qt Wrapped File",
- no_working_dir);
+ mf.AddCustomCommandToOutput(newName, depends, no_main_dependency,
+ commandLines, "Qt Wrapped File",
+ no_working_dir);
}
}
// Store the final list of source files.
- this->Makefile->AddDefinition(sourceList, sourceListValue);
+ mf.AddDefinition(sourceList, sourceListValue);
return true;
}
diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h
index 88a2210..75fa180 100644
--- a/Source/cmQTWrapCPPCommand.h
+++ b/Source/cmQTWrapCPPCommand.h
@@ -8,35 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmQTWrapCPPCommand
- * \brief Create moc file rules for Qt classes
- *
- * cmQTWrapCPPCommand is used to create wrappers for Qt classes into
- * normal C++
- */
-class cmQTWrapCPPCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmQTWrapCPPCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 8bc914f..b7b5efa 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -2,52 +2,50 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQTWrapUICommand.h"
+#include <utility>
+
#include "cmCustomCommandLines.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-#include <utility>
-
-class cmExecutionStatus;
-
-// cmQTWrapUICommand
-bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmQTWrapUICommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 4) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// Get the uic and moc executables to run in the custom commands.
- std::string const& uic_exe =
- this->Makefile->GetRequiredDefinition("QT_UIC_EXECUTABLE");
- std::string const& moc_exe =
- this->Makefile->GetRequiredDefinition("QT_MOC_EXECUTABLE");
+ std::string const& uic_exe = mf.GetRequiredDefinition("QT_UIC_EXECUTABLE");
+ std::string const& moc_exe = mf.GetRequiredDefinition("QT_MOC_EXECUTABLE");
// Get the variable holding the list of sources.
std::string const& headerList = args[1];
std::string const& sourceList = args[2];
- std::string headerListValue = this->Makefile->GetSafeDefinition(headerList);
- std::string sourceListValue = this->Makefile->GetSafeDefinition(sourceList);
+ std::string headerListValue = mf.GetSafeDefinition(headerList);
+ std::string sourceListValue = mf.GetSafeDefinition(sourceList);
// Create rules for all sources listed.
for (std::string const& arg : cmMakeRange(args).advance(3)) {
- cmSourceFile* curr = this->Makefile->GetSource(arg);
+ cmSourceFile* curr = mf.GetSource(arg);
// if we should wrap the class
if (!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) {
// Compute the name of the files to generate.
std::string srcName =
cmSystemTools::GetFilenameWithoutLastExtension(arg);
- std::string hName = cmStrCat(this->Makefile->GetCurrentBinaryDirectory(),
- '/', srcName, ".h");
- std::string cxxName = cmStrCat(
- this->Makefile->GetCurrentBinaryDirectory(), '/', srcName, ".cxx");
- std::string mocName = cmStrCat(
- this->Makefile->GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx");
+ std::string hName =
+ cmStrCat(mf.GetCurrentBinaryDirectory(), '/', srcName, ".h");
+ std::string cxxName =
+ cmStrCat(mf.GetCurrentBinaryDirectory(), '/', srcName, ".cxx");
+ std::string mocName =
+ cmStrCat(mf.GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx");
// Compute the name of the ui file from which to generate others.
std::string uiName;
@@ -55,9 +53,9 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
uiName = arg;
} else {
if (curr && curr->GetIsGenerated()) {
- uiName = this->Makefile->GetCurrentBinaryDirectory();
+ uiName = mf.GetCurrentBinaryDirectory();
} else {
- uiName = this->Makefile->GetCurrentSourceDirectory();
+ uiName = mf.GetCurrentSourceDirectory();
}
uiName += "/";
uiName += arg;
@@ -109,25 +107,22 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
std::string no_main_dependency;
const char* no_comment = nullptr;
const char* no_working_dir = nullptr;
- this->Makefile->AddCustomCommandToOutput(
- hName, depends, no_main_dependency, hCommandLines, no_comment,
- no_working_dir);
+ mf.AddCustomCommandToOutput(hName, depends, no_main_dependency,
+ hCommandLines, no_comment, no_working_dir);
depends.push_back(hName);
- this->Makefile->AddCustomCommandToOutput(
- cxxName, depends, no_main_dependency, cxxCommandLines, no_comment,
- no_working_dir);
+ mf.AddCustomCommandToOutput(cxxName, depends, no_main_dependency,
+ cxxCommandLines, no_comment, no_working_dir);
depends.clear();
depends.push_back(hName);
- this->Makefile->AddCustomCommandToOutput(
- mocName, depends, no_main_dependency, mocCommandLines, no_comment,
- no_working_dir);
+ mf.AddCustomCommandToOutput(mocName, depends, no_main_dependency,
+ mocCommandLines, no_comment, no_working_dir);
}
}
// Store the final list of source files and headers.
- this->Makefile->AddDefinition(sourceList, sourceListValue);
- this->Makefile->AddDefinition(headerList, headerListValue);
+ mf.AddDefinition(sourceList, sourceListValue);
+ mf.AddDefinition(headerList, headerListValue);
return true;
}
diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h
index 6a346d4..a17ef54 100644
--- a/Source/cmQTWrapUICommand.h
+++ b/Source/cmQTWrapUICommand.h
@@ -8,34 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmQTWrapUICommand
- * \brief Create .h and .cxx files rules for Qt user interfaces files
- *
- * cmQTWrapUICommand is used to create wrappers for Qt classes into normal C++
- */
-class cmQTWrapUICommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmQTWrapUICommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmQTWrapUICommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx
index 8d3f688..339ff9d 100644
--- a/Source/cmRemoveDefinitionsCommand.cxx
+++ b/Source/cmRemoveDefinitionsCommand.cxx
@@ -2,21 +2,15 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmRemoveDefinitionsCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
-class cmExecutionStatus;
-
-// cmRemoveDefinitionsCommand
-bool cmRemoveDefinitionsCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmRemoveDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
- // it is OK to have no arguments
- if (args.empty()) {
- return true;
- }
-
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
- this->Makefile->RemoveDefineFlag(i);
+ mf.RemoveDefineFlag(i);
}
return true;
}
diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h
index 85d01d4..868416b 100644
--- a/Source/cmRemoveDefinitionsCommand.h
+++ b/Source/cmRemoveDefinitionsCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmRemoveDefinitionsCommand
- * \brief Specify a list of compiler defines
- *
- * cmRemoveDefinitionsCommand specifies a list of compiler defines.
- * These defines will
- * be removed from the compile command.
- */
-class cmRemoveDefinitionsCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmRemoveDefinitionsCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmRemoveDefinitionsCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
index 8e3217f..7ff604b 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.cxx
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -2,18 +2,23 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSetSourceFilesPropertiesCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
-class cmExecutionStatus;
+static bool RunCommand(cmMakefile* mf,
+ std::vector<std::string>::const_iterator filebeg,
+ std::vector<std::string>::const_iterator fileend,
+ std::vector<std::string>::const_iterator propbeg,
+ std::vector<std::string>::const_iterator propend,
+ std::string& errors);
-// cmSetSourceFilesPropertiesCommand
-bool cmSetSourceFilesPropertiesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.size() < 2) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
@@ -29,22 +34,24 @@ bool cmSetSourceFilesPropertiesCommand::InitialPass(
++j;
}
+ cmMakefile& mf = status.GetMakefile();
+
// now call the worker function
std::string errors;
- bool ret = cmSetSourceFilesPropertiesCommand::RunCommand(
- this->Makefile, args.begin(), args.begin() + numFiles,
- args.begin() + numFiles, args.end(), errors);
+ bool ret = RunCommand(&mf, args.begin(), args.begin() + numFiles,
+ args.begin() + numFiles, args.end(), errors);
if (!ret) {
- this->SetError(errors);
+ status.SetError(errors);
}
return ret;
}
-bool cmSetSourceFilesPropertiesCommand::RunCommand(
- cmMakefile* mf, std::vector<std::string>::const_iterator filebeg,
- std::vector<std::string>::const_iterator fileend,
- std::vector<std::string>::const_iterator propbeg,
- std::vector<std::string>::const_iterator propend, std::string& errors)
+static bool RunCommand(cmMakefile* mf,
+ std::vector<std::string>::const_iterator filebeg,
+ std::vector<std::string>::const_iterator fileend,
+ std::vector<std::string>::const_iterator propbeg,
+ std::vector<std::string>::const_iterator propend,
+ std::string& errors)
{
std::vector<std::string> propertyPairs;
bool generated = false;
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
index 6fd6c41..5eef785 100644
--- a/Source/cmSetSourceFilesPropertiesCommand.h
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -8,34 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmMakefile;
-
-class cmSetSourceFilesPropertiesCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmSetSourceFilesPropertiesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
- static bool RunCommand(cmMakefile* mf,
- std::vector<std::string>::const_iterator filebeg,
- std::vector<std::string>::const_iterator fileend,
- std::vector<std::string>::const_iterator propbeg,
- std::vector<std::string>::const_iterator propend,
- std::string& errors);
-};
+bool cmSetSourceFilesPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index ed909c6..de61eda 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -5,21 +5,25 @@
#include <iterator>
#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmTest.h"
-class cmExecutionStatus;
+static bool SetOneTest(const std::string& tname,
+ std::vector<std::string>& propertyPairs, cmMakefile* mf,
+ std::string& errors);
-// cmSetTestsPropertiesCommand
-bool cmSetTestsPropertiesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+
// first collect up the list of files
std::vector<std::string> propertyPairs;
int numFiles = 0;
@@ -29,7 +33,7 @@ bool cmSetTestsPropertiesCommand::InitialPass(
// now loop through the rest of the arguments, new style
++j;
if (std::distance(j, args.end()) % 2 != 0) {
- this->SetError("called with incorrect number of arguments.");
+ status.SetError("called with incorrect number of arguments.");
return false;
}
cmAppend(propertyPairs, j, args.end());
@@ -38,8 +42,8 @@ bool cmSetTestsPropertiesCommand::InitialPass(
numFiles++;
}
if (propertyPairs.empty()) {
- this->SetError("called with illegal arguments, maybe "
- "missing a PROPERTIES specifier?");
+ status.SetError("called with illegal arguments, maybe "
+ "missing a PROPERTIES specifier?");
return false;
}
@@ -47,10 +51,9 @@ bool cmSetTestsPropertiesCommand::InitialPass(
int i;
for (i = 0; i < numFiles; ++i) {
std::string errors;
- bool ret = cmSetTestsPropertiesCommand::SetOneTest(args[i], propertyPairs,
- this->Makefile, errors);
+ bool ret = SetOneTest(args[i], propertyPairs, &mf, errors);
if (!ret) {
- this->SetError(errors);
+ status.SetError(errors);
return ret;
}
}
@@ -58,9 +61,9 @@ bool cmSetTestsPropertiesCommand::InitialPass(
return true;
}
-bool cmSetTestsPropertiesCommand::SetOneTest(
- const std::string& tname, std::vector<std::string>& propertyPairs,
- cmMakefile* mf, std::string& errors)
+static bool SetOneTest(const std::string& tname,
+ std::vector<std::string>& propertyPairs, cmMakefile* mf,
+ std::string& errors)
{
if (cmTest* test = mf->GetTest(tname)) {
// now loop through all the props and set them
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index d73e95a..4b75464 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -8,31 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmMakefile;
-
-class cmSetTestsPropertiesCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmSetTestsPropertiesCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the input file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
- static bool SetOneTest(const std::string& tname,
- std::vector<std::string>& propertyPairs,
- cmMakefile* mf, std::string& errors);
-};
+bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index 07f8efe..2477d7a 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -2,22 +2,21 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmSubdirCommand.h"
+#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
-class cmExecutionStatus;
-
-// cmSubdirCommand
-bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus&)
+bool cmSubdirCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
bool res = true;
bool excludeFromAll = false;
+ cmMakefile& mf = status.GetMakefile();
for (std::string const& i : args) {
if (i == "EXCLUDE_FROM_ALL") {
@@ -30,24 +29,21 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args,
}
// if they specified a relative path then compute the full
- std::string srcPath =
- this->Makefile->GetCurrentSourceDirectory() + "/" + i;
+ std::string srcPath = mf.GetCurrentSourceDirectory() + "/" + i;
if (cmSystemTools::FileIsDirectory(srcPath)) {
- std::string binPath =
- this->Makefile->GetCurrentBinaryDirectory() + "/" + i;
- this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false);
+ std::string binPath = mf.GetCurrentBinaryDirectory() + "/" + i;
+ mf.AddSubDirectory(srcPath, binPath, excludeFromAll, false);
}
// otherwise it is a full path
else if (cmSystemTools::FileIsDirectory(i)) {
// we must compute the binPath from the srcPath, we just take the last
// element from the source path and use that
- std::string binPath = this->Makefile->GetCurrentBinaryDirectory() + "/" +
+ std::string binPath = mf.GetCurrentBinaryDirectory() + "/" +
cmSystemTools::GetFilenameName(i);
- this->Makefile->AddSubDirectory(i, binPath, excludeFromAll, false);
+ mf.AddSubDirectory(i, binPath, excludeFromAll, false);
} else {
- std::string error = cmStrCat("Incorrect SUBDIRS command. Directory: ", i,
- " does not exist.");
- this->SetError(error);
+ status.SetError(cmStrCat("Incorrect SUBDIRS command. Directory: ", i,
+ " does not exist."));
res = false;
}
}
diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h
index 3499c46..3254e84 100644
--- a/Source/cmSubdirCommand.h
+++ b/Source/cmSubdirCommand.h
@@ -8,36 +8,9 @@
#include <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-/** \class cmSubdirCommand
- * \brief Specify a list of subdirectories to build.
- *
- * cmSubdirCommand specifies a list of subdirectories to process
- * by CMake. For each subdirectory listed, CMake will descend
- * into that subdirectory and process any CMakeLists.txt found.
- */
-class cmSubdirCommand : public cmCommand
-{
-public:
- /**
- * This is a virtual constructor for the command.
- */
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmSubdirCommand>();
- }
-
- /**
- * This is called when the command is first encountered in
- * the CMakeLists.txt file.
- */
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmSubdirCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif