summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomCommandCommand.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/cmAddCustomCommandCommand.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/cmAddCustomCommandCommand.cxx')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx40
1 files changed, 8 insertions, 32 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index d7afb57..c91198c 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -12,7 +12,6 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
-#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -50,7 +49,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
bool uses_terminal = false;
bool command_expand_lists = false;
std::string implicit_depends_lang;
- cmCustomCommand::ImplicitDependsList implicit_depends;
+ cmImplicitDependsList implicit_depends;
// Accumulate one command line at a time.
cmCustomCommandLine currentLine;
@@ -316,14 +315,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.
@@ -350,28 +344,10 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
job_pool, command_expand_lists);
} else if (target.empty()) {
// Target is empty, use the output.
- mf.AddCustomCommandToOutput(output, byproducts, depends, main_dependency,
- commandLines, comment, working.c_str(), false,
- escapeOldStyle, uses_terminal,
- command_expand_lists, depfile, job_pool);
-
- // Add implicit dependency scanning requests if any were given.
- if (!implicit_depends.empty()) {
- bool okay = false;
- if (cmSourceFile* sf = mf.GetSourceFileWithOutput(output[0])) {
- if (cmCustomCommand* cc = sf->GetCustomCommand()) {
- okay = true;
- cc->SetImplicitDepends(implicit_depends);
- }
- }
- if (!okay) {
- std::ostringstream e;
- e << "could not locate source file with a custom command producing \""
- << output[0] << "\" even though this command tried to create it!";
- status.SetError(e.str());
- return false;
- }
- }
+ mf.AddCustomCommandToOutput(
+ output, byproducts, depends, main_dependency, implicit_depends,
+ commandLines, comment, working.c_str(), false, escapeOldStyle,
+ uses_terminal, command_expand_lists, depfile, job_pool);
} else if (!byproducts.empty()) {
status.SetError("BYPRODUCTS may not be specified with SOURCE signatures");
return false;