diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommands.cxx | 3 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 28 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.h | 16 |
3 files changed, 17 insertions, 30 deletions
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index bbfea90..6f79c9a 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -314,8 +314,7 @@ void GetProjectCommands(cmState* state) "The export_library_dependencies command should not be called; " "see CMP0033."); state->AddDisallowedCommand( - "load_command", cm::make_unique<cmLoadCommandCommand>(), - cmPolicies::CMP0031, + "load_command", cmLoadCommandCommand, cmPolicies::CMP0031, "The load_command command should not be called; see CMP0031."); state->AddDisallowedCommand( "output_required_files", cm::make_unique<cmOutputRequiredFilesCommand>(), diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 180e65b..f650eb1 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -14,14 +14,14 @@ #include "cmCPluginAPI.cxx" #include "cmCPluginAPI.h" +#include "cmCommand.h" #include "cmDynamicLoader.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; - #ifdef __QNX__ # include <malloc.h> /* for malloc/free on QNX */ #endif @@ -175,8 +175,8 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args, } // namespace // cmLoadCommandCommand -bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmLoadCommandCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.empty()) { return true; @@ -185,13 +185,13 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // Construct a variable to report what file was loaded, if any. // Start by removing the definition in case of failure. std::string reportVar = cmStrCat("CMAKE_LOADED_COMMAND_", args[0]); - this->Makefile->RemoveDefinition(reportVar); + status.GetMakefile().RemoveDefinition(reportVar); // the file must exist std::string moduleName = cmStrCat( - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_MODULE_PREFIX"), "cm", - args[0], - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_MODULE_SUFFIX")); + status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_PREFIX"), + "cm", args[0], + status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_SUFFIX")); // search for the file std::vector<std::string> path; @@ -209,7 +209,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, if (fullPath.empty()) { std::ostringstream e; e << "Attempt to load command failed from file \"" << moduleName << "\""; - this->SetError(e.str()); + status.SetError(e.str()); return false; } @@ -224,12 +224,12 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, err += " Additional error info is:\n"; err += error; } - this->SetError(err); + status.SetError(err); return false; } // Report what file was loaded for this command. - this->Makefile->AddDefinition(reportVar, fullPath); + status.GetMakefile().AddDefinition(reportVar, fullPath); // find the init function std::string initFuncName = args[0] + "Init"; @@ -243,12 +243,12 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // if the symbol is found call it to set the name on the // function blocker if (initFunction) { - this->Makefile->GetState()->AddScriptedCommand( + status.GetMakefile().GetState()->AddScriptedCommand( args[0], cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction))); return true; } - this->SetError("Attempt to load command failed. " - "No init function found."); + status.SetError("Attempt to load command failed. " + "No init function found."); return false; } diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index d81cefb..f5fd754 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmLoadCommandCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmLoadCommandCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmLoadCommandCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif |