summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-09-16 14:16:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-09-16 14:18:51 (GMT)
commit7c47894b459c0f71ebe32b64a619f290df6bcf44 (patch)
tree968b49e366e60ab1c0afe0849abd8dac6edeb1f4 /Source/cmMakefile.cxx
parent1df2f8803b79c2e27d123de4f3f351bae824feef (diff)
parent5d28e361b709a781a131cb9d9da73f04484eff54 (diff)
downloadCMake-7c47894b459c0f71ebe32b64a619f290df6bcf44.zip
CMake-7c47894b459c0f71ebe32b64a619f290df6bcf44.tar.gz
CMake-7c47894b459c0f71ebe32b64a619f290df6bcf44.tar.bz2
Merge topic 'prepare-deferred-custom-command-creation'
5d28e361b7 add_custom_command: Move append functionality into class cmMakefile 4fb29850ad add_custom_command: Refactor setting implicit depends Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3810
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx33
1 files changed, 27 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9e64f97..caf4168 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -945,6 +945,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends, const std::string& main_dependency,
+ const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace, bool escapeOldStyle,
bool uses_terminal, bool command_expand_lists, const std::string& depfile,
@@ -1029,6 +1030,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
this, outputs, byproducts, depends2, commandLines, comment, workingDir);
cc->SetEscapeOldStyle(escapeOldStyle);
cc->SetEscapeAllowMakeVars(true);
+ cc->SetImplicitDepends(implicit_depends);
cc->SetUsesTerminal(uses_terminal);
cc->SetCommandExpandLists(command_expand_lists);
cc->SetDepfile(depfile);
@@ -1087,10 +1089,11 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput(
std::vector<std::string> outputs;
outputs.push_back(output);
std::vector<std::string> no_byproducts;
+ cmImplicitDependsList no_implicit_depends;
return this->AddCustomCommandToOutput(
- outputs, no_byproducts, depends, main_dependency, commandLines, comment,
- workingDir, replace, escapeOldStyle, uses_terminal, command_expand_lists,
- depfile, job_pool);
+ outputs, no_byproducts, depends, main_dependency, no_implicit_depends,
+ commandLines, comment, workingDir, replace, escapeOldStyle, uses_terminal,
+ command_expand_lists, depfile, job_pool);
}
void cmMakefile::AddCustomCommandOldStyle(
@@ -1151,6 +1154,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,
@@ -1224,11 +1244,12 @@ cmTarget* cmMakefile::AddUtilityCommand(
std::vector<std::string> forced;
forced.push_back(force);
std::string no_main_dependency;
+ cmImplicitDependsList no_implicit_depends;
bool no_replace = false;
this->AddCustomCommandToOutput(
- forced, byproducts, depends, no_main_dependency, commandLines, comment,
- workingDirectory, no_replace, escapeOldStyle, uses_terminal,
- command_expand_lists, /*depfile=*/"", job_pool);
+ forced, byproducts, depends, no_main_dependency, no_implicit_depends,
+ commandLines, comment, workingDirectory, no_replace, escapeOldStyle,
+ uses_terminal, command_expand_lists, /*depfile=*/"", job_pool);
cmSourceFile* sf = target->AddSourceCMP0049(force);
// The output is not actually created so mark it symbolic.