From 9d6fc3f5ed527874d44a111eb80c09e740710e48 Mon Sep 17 00:00:00 2001 From: Gabor Bencze Date: Wed, 21 Aug 2019 19:56:15 +0200 Subject: cmCommand refactor: cmExportLibraryDependenciesCommand --- Source/cmCommands.cxx | 4 ++-- Source/cmExportLibraryDependenciesCommand.cxx | 16 ++++++++-------- Source/cmExportLibraryDependenciesCommand.h | 16 ++-------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 6cb7d80..bbfea90 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -309,8 +309,8 @@ void GetProjectCommands(cmState* state) cm::make_unique()); state->AddDisallowedCommand( - "export_library_dependencies", - cm::make_unique(), cmPolicies::CMP0033, + "export_library_dependencies", cmExportLibraryDependenciesCommand, + cmPolicies::CMP0033, "The export_library_dependencies command should not be called; " "see CMP0033."); state->AddDisallowedCommand( diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 81237db..bab394a 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -8,6 +8,7 @@ #include "cm_memory.hxx" +#include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" @@ -18,8 +19,6 @@ #include "cmTargetLinkLibraryType.h" #include "cmake.h" -class cmExecutionStatus; - static void FinalAction(cmMakefile& makefile, std::string const& filename, bool append) { @@ -140,19 +139,20 @@ static void FinalAction(cmMakefile& makefile, std::string const& filename, fout << "endif()\n"; } -bool cmExportLibraryDependenciesCommand::InitialPass( - std::vector const& args, cmExecutionStatus&) +bool cmExportLibraryDependenciesCommand(std::vector 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; } std::string const& filename = args[0]; bool const append = args.size() > 1 && args[1] == "APPEND"; - this->Makefile->AddFinalAction([filename, append](cmMakefile& makefile) { - FinalAction(makefile, filename, append); - }); + status.GetMakefile().AddFinalAction( + [filename, append](cmMakefile& makefile) { + FinalAction(makefile, filename, append); + }); return true; } diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 4817162..230c906 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -8,21 +8,9 @@ #include #include -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmExportLibraryDependenciesCommand : public cmCommand -{ -public: - std::unique_ptr Clone() override - { - return cm::make_unique(); - } - bool InitialPass(std::vector const& args, - cmExecutionStatus& status) override; -}; +bool cmExportLibraryDependenciesCommand(std::vector const& args, + cmExecutionStatus& status); #endif -- cgit v0.12