summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Bencze <b.gabor98@gmail.com>2019-08-21 17:56:15 (GMT)
committerGabor Bencze <b.gabor98@gmail.com>2019-08-25 12:29:25 (GMT)
commit9d6fc3f5ed527874d44a111eb80c09e740710e48 (patch)
tree418c3678bb6364b6441782c03835494a674f4c36
parent524d72151449acf5d76e55172174552b83a74f61 (diff)
downloadCMake-9d6fc3f5ed527874d44a111eb80c09e740710e48.zip
CMake-9d6fc3f5ed527874d44a111eb80c09e740710e48.tar.gz
CMake-9d6fc3f5ed527874d44a111eb80c09e740710e48.tar.bz2
cmCommand refactor: cmExportLibraryDependenciesCommand
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx16
-rw-r--r--Source/cmExportLibraryDependenciesCommand.h16
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<cmSourceGroupCommand>());
state->AddDisallowedCommand(
- "export_library_dependencies",
- cm::make_unique<cmExportLibraryDependenciesCommand>(), 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<std::string> const& args, cmExecutionStatus&)
+bool cmExportLibraryDependenciesCommand(std::vector<std::string> 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 <string>
#include <vector>
-#include "cm_memory.hxx"
-
-#include "cmCommand.h"
-
class cmExecutionStatus;
-class cmExportLibraryDependenciesCommand : public cmCommand
-{
-public:
- std::unique_ptr<cmCommand> Clone() override
- {
- return cm::make_unique<cmExportLibraryDependenciesCommand>();
- }
- bool InitialPass(std::vector<std::string> const& args,
- cmExecutionStatus& status) override;
-};
+bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status);
#endif