|
|
@@ -40,6 +40,8 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
std::vector<std::string> depends, outputs, output;
|
|
|
bool verbatim = false;
|
|
|
bool append = false;
|
|
|
+ std::string implicit_depends_lang;
|
|
|
+ cmCustomCommand::ImplicitDependsList implicit_depends;
|
|
|
|
|
|
// Accumulate one command line at a time.
|
|
|
cmCustomCommandLine currentLine;
|
|
|
@@ -54,6 +56,8 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
doing_command,
|
|
|
doing_target,
|
|
|
doing_depends,
|
|
|
+ doing_implicit_depends_lang,
|
|
|
+ doing_implicit_depends_file,
|
|
|
doing_main_dependency,
|
|
|
doing_output,
|
|
|
doing_outputs,
|
|
|
@@ -131,6 +135,10 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
{
|
|
|
doing = doing_main_dependency;
|
|
|
}
|
|
|
+ else if (copy == "IMPLICIT_DEPENDS")
|
|
|
+ {
|
|
|
+ doing = doing_implicit_depends_lang;
|
|
|
+ }
|
|
|
else if (copy == "COMMENT")
|
|
|
{
|
|
|
doing = doing_comment;
|
|
|
@@ -173,6 +181,25 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
case doing_main_dependency:
|
|
|
main_dependency = copy;
|
|
|
break;
|
|
|
+ case doing_implicit_depends_lang:
|
|
|
+ implicit_depends_lang = copy;
|
|
|
+ doing = doing_implicit_depends_file;
|
|
|
+ break;
|
|
|
+ case doing_implicit_depends_file:
|
|
|
+ {
|
|
|
+ // An implicit dependency starting point is also an
|
|
|
+ // explicit dependency.
|
|
|
+ depends.push_back(copy);
|
|
|
+
|
|
|
+ // Add the implicit dependency language and file.
|
|
|
+ cmCustomCommand::ImplicitDependsPair
|
|
|
+ entry(implicit_depends_lang, copy);
|
|
|
+ implicit_depends.push_back(entry);
|
|
|
+
|
|
|
+ // Switch back to looking for a language.
|
|
|
+ doing = doing_implicit_depends_lang;
|
|
|
+ }
|
|
|
+ break;
|
|
|
case doing_command:
|
|
|
currentLine.push_back(copy);
|
|
|
break;
|
|
|
@@ -240,6 +267,7 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
{
|
|
|
cc->AppendCommands(commandLines);
|
|
|
cc->AppendDepends(depends);
|
|
|
+ cc->AppendImplicitDepends(implicit_depends);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
@@ -271,6 +299,29 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
commandLines, comment,
|
|
|
working.c_str(), false,
|
|
|
escapeOldStyle);
|
|
|
+
|
|
|
+ // Add implicit dependency scanning requests if any were given.
|
|
|
+ if(!implicit_depends.empty())
|
|
|
+ {
|
|
|
+ bool okay = false;
|
|
|
+ if(cmSourceFile* sf =
|
|
|
+ this->Makefile->GetSourceFileWithOutput(output[0].c_str()))
|
|
|
+ {
|
|
|
+ if(cmCustomCommand* cc = sf->GetCustomCommand())
|
|
|
+ {
|
|
|
+ okay = true;
|
|
|
+ cc->SetImplicitDepends(implicit_depends);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!okay)
|
|
|
+ {
|
|
|
+ cmOStringStream e;
|
|
|
+ e << "could not locate source file with a custom command producing \""
|
|
|
+ << output[0] << "\" even though this command tried to create it!";
|
|
|
+ this->SetError(e.str().c_str());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -279,6 +330,7 @@ bool cmAddCustomCommandCommand::InitialPass(
|
|
|
source.c_str(), commandLines,
|
|
|
comment);
|
|
|
}
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|