mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 22:37:30 +08:00
cmCommand refactor: cmExportLibraryDependenciesCommand
This commit is contained in:
@@ -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(
|
||||||
|
@@ -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,19 +139,20 @@ 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(
|
||||||
FinalAction(makefile, filename, append);
|
[filename, append](cmMakefile& makefile) {
|
||||||
});
|
FinalAction(makefile, filename, append);
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user