1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 03:48:02 +08:00

cmCommand refactor: cmExportLibraryDependenciesCommand

This commit is contained in:
Gabor Bencze
2019-08-21 19:56:15 +02:00
parent 524d721514
commit 9d6fc3f5ed
3 changed files with 12 additions and 24 deletions

View File

@@ -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(

View File

@@ -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;
}

View File

@@ -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