diff options
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9e64f97..f35b999 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -5,16 +5,18 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" #include <algorithm> -#include <assert.h> +#include <cassert> +#include <cctype> +#include <cstdio> +#include <cstdlib> #include <cstring> -#include <ctype.h> #include <iterator> #include <memory> #include <sstream> -#include <stdio.h> -#include <stdlib.h> #include <utility> +#include "cm_memory.hxx" + #include "cmAlgorithms.h" #include "cmCommandArgumentParserHelper.h" #include "cmCustomCommand.h" @@ -945,6 +947,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, @@ -1025,15 +1028,16 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( depends2.push_back(main_dependency); } - cmCustomCommand* cc = new cmCustomCommand( + std::unique_ptr<cmCustomCommand> cc = cm::make_unique<cmCustomCommand>( 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); cc->SetJobPool(job_pool); - file->SetCustomCommand(cc); + file->SetCustomCommand(std::move(cc)); this->UpdateOutputToSourceMap(outputs, file, false); this->UpdateOutputToSourceMap(byproducts, file, true); } @@ -1087,10 +1091,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 +1156,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 +1246,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. |