summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-12 10:10:28 +0200
committerRegina Pfeifer <regina@mailbox.org>2019-09-12 18:16:17 +0200
commit36b939db682a9405790bee76f95673eeaeb445b8 (patch)
tree4cd7861df88ef4bc2a82dae4290594c94cfac76a /Source
parent28cf1271ed6051af46ff68f52a8c9c0435ca1234 (diff)
downloadcmake-36b939db682a9405790bee76f95673eeaeb445b8.tar.gz
cmFLTKWrapUICommand: Port away from cmCommand
Ref: #19499
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommands.cxx3
-rw-r--r--Source/cmFLTKWrapUICommand.cxx39
-rw-r--r--Source/cmFLTKWrapUICommand.h30
3 files changed, 22 insertions, 50 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index f30fcb537a..9ce4c14eb8 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -282,8 +282,7 @@ 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("fltk_wrap_ui", cmFLTKWrapUICommand);
state->AddBuiltinCommand(
"include_external_msproject",
cm::make_unique<cmIncludeExternalMSProjectCommand>());
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index ea9e672f32..5094c3c632 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 ea8d40150b..bb56dbd44f 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