1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 14:08:35 +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>()); cm::make_unique<cmSourceGroupCommand>());
state->AddDisallowedCommand( state->AddDisallowedCommand(
"export_library_dependencies", "export_library_dependencies", cmExportLibraryDependenciesCommand,
cm::make_unique<cmExportLibraryDependenciesCommand>(), cmPolicies::CMP0033, cmPolicies::CMP0033,
"The export_library_dependencies command should not be called; " "The export_library_dependencies command should not be called; "
"see CMP0033."); "see CMP0033.");
state->AddDisallowedCommand( state->AddDisallowedCommand(

View File

@@ -8,6 +8,7 @@
#include "cm_memory.hxx" #include "cm_memory.hxx"
#include "cmExecutionStatus.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
@@ -18,8 +19,6 @@
#include "cmTargetLinkLibraryType.h" #include "cmTargetLinkLibraryType.h"
#include "cmake.h" #include "cmake.h"
class cmExecutionStatus;
static void FinalAction(cmMakefile& makefile, std::string const& filename, static void FinalAction(cmMakefile& makefile, std::string const& filename,
bool append) bool append)
{ {
@@ -140,17 +139,18 @@ static void FinalAction(cmMakefile& makefile, std::string const& filename,
fout << "endif()\n"; fout << "endif()\n";
} }
bool cmExportLibraryDependenciesCommand::InitialPass( bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
std::vector<std::string> const& args, cmExecutionStatus&) cmExecutionStatus& status)
{ {
if (args.empty()) { if (args.empty()) {
this->SetError("called with incorrect number of arguments"); status.SetError("called with incorrect number of arguments");
return false; return false;
} }
std::string const& filename = args[0]; std::string const& filename = args[0];
bool const append = args.size() > 1 && args[1] == "APPEND"; bool const append = args.size() > 1 && args[1] == "APPEND";
this->Makefile->AddFinalAction([filename, append](cmMakefile& makefile) { status.GetMakefile().AddFinalAction(
[filename, append](cmMakefile& makefile) {
FinalAction(makefile, filename, append); FinalAction(makefile, filename, append);
}); });

View File

@@ -8,21 +8,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "cm_memory.hxx"
#include "cmCommand.h"
class cmExecutionStatus; class cmExecutionStatus;
class cmExportLibraryDependenciesCommand : public cmCommand bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args,
{ cmExecutionStatus& status);
public:
std::unique_ptr<cmCommand> Clone() override
{
return cm::make_unique<cmExportLibraryDependenciesCommand>();
}
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
};
#endif #endif