mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
add_custom_command: Move append functionality into class cmMakefile
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
#include "cmMakefile.h"
|
||||
#include "cmMessageType.h"
|
||||
#include "cmPolicies.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
@@ -317,14 +316,9 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
|
||||
|
||||
// Check for an append request.
|
||||
if (append) {
|
||||
// Lookup an existing command.
|
||||
if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
|
||||
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
|
||||
cc->AppendCommands(commandLines);
|
||||
cc->AppendDepends(depends);
|
||||
cc->AppendImplicitDepends(implicit_depends);
|
||||
return true;
|
||||
}
|
||||
if (mf.AppendCustomCommandToOutput(output[0], depends, implicit_depends,
|
||||
commandLines)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// No command for this output exists.
|
||||
|
||||
@@ -1111,6 +1111,23 @@ void cmMakefile::AddCustomCommandOldStyle(
|
||||
}
|
||||
}
|
||||
|
||||
bool cmMakefile::AppendCustomCommandToOutput(
|
||||
const std::string& output, const std::vector<std::string>& depends,
|
||||
const cmImplicitDependsList& implicit_depends,
|
||||
const cmCustomCommandLines& commandLines)
|
||||
{
|
||||
// Lookup an existing command.
|
||||
if (cmSourceFile* sf = this->GetSourceFileWithOutput(output)) {
|
||||
if (cmCustomCommand* cc = sf->GetCustomCommand()) {
|
||||
cc->AppendCommands(commandLines);
|
||||
cc->AppendDepends(depends);
|
||||
cc->AppendImplicitDepends(implicit_depends);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cmTarget* cmMakefile::AddUtilityCommand(
|
||||
const std::string& utilityName, TargetOrigin origin, bool excludeFromAll,
|
||||
const std::vector<std::string>& depends, const char* workingDirectory,
|
||||
|
||||
@@ -185,6 +185,10 @@ public:
|
||||
const std::string& source,
|
||||
const cmCustomCommandLines& commandLines,
|
||||
const char* comment);
|
||||
bool AppendCustomCommandToOutput(
|
||||
const std::string& output, const std::vector<std::string>& depends,
|
||||
const cmImplicitDependsList& implicit_depends,
|
||||
const cmCustomCommandLines& commandLines);
|
||||
|
||||
/**
|
||||
* Add a define flag to the build.
|
||||
|
||||
Reference in New Issue
Block a user