diff options
Diffstat (limited to 'Source/cmQTWrapCPPCommand.cxx')
-rw-r--r-- | Source/cmQTWrapCPPCommand.cxx | 41 |
1 files changed, 20 insertions, 21 deletions
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; } |