summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 08:15:29 (GMT)
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 16:16:17 (GMT)
commit06a2e764f0f088a212e20b85e364b5621ef639fe (patch)
tree9ad643d2af13c967973b1e66ecc5393c60fbd918
parentb46970cfe9e0c96a9794acb49fc580565bcd6e91 (diff)
downloadCMake-06a2e764f0f088a212e20b85e364b5621ef639fe.zip
CMake-06a2e764f0f088a212e20b85e364b5621ef639fe.tar.gz
CMake-06a2e764f0f088a212e20b85e364b5621ef639fe.tar.bz2
cmIncludeExternalMSProjectCommand: Port away from cmCommand
Ref: #19499
-rw-r--r--Source/cmCommands.cxx5
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.cxx32
-rw-r--r--Source/cmIncludeExternalMSProjectCommand.h31
3 files changed, 20 insertions, 48 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 2bdddc9..a82559d 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -281,9 +281,8 @@ void GetProjectCommands(cmState* state)
cmAuxSourceDirectoryCommand);
state->AddBuiltinCommand("export", cm::make_unique<cmExportCommand>());
state->AddBuiltinCommand("fltk_wrap_ui", cmFLTKWrapUICommand);
- state->AddBuiltinCommand(
- "include_external_msproject",
- cm::make_unique<cmIncludeExternalMSProjectCommand>());
+ state->AddBuiltinCommand("include_external_msproject",
+ cmIncludeExternalMSProjectCommand);
state->AddBuiltinCommand("install_programs",
cm::make_unique<cmInstallProgramsCommand>());
state->AddBuiltinCommand("add_link_options", cmAddLinkOptionsCommand);
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