Ninja: Don't limit custom cmd side-effects to build folder (#14972)

Actually custom command can write wherever it wants to, such as temporary
folder or source folder, possibly violating rules that only build folder should
be affected. Therefore we should consider custom command dependency at any path
as possible side effect adding phony rule.

We avoid adding phony rules for regular source files (since the paraent
commit) so we no longer need the in-build-tree test to avoid them.
This commit is contained in:
Adam Strzelecki 2014-06-27 22:13:51 +02:00 committed by Brad King
parent a33cf6d088
commit 7243c95129
1 changed files with 6 additions and 16 deletions

View File

@ -1033,20 +1033,11 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
std::back_inserter(unkownExplicitDepends)); std::back_inserter(unkownExplicitDepends));
std::string const rootBuildDirectory =
this->GetCMakeInstance()->GetHomeOutputDirectory();
for (std::vector<std::string>::const_iterator for (std::vector<std::string>::const_iterator
i = unkownExplicitDepends.begin(); i = unkownExplicitDepends.begin();
i != unkownExplicitDepends.end(); i != unkownExplicitDepends.end();
++i) ++i)
{ {
//verify the file is in the build directory
std::string const absDepPath = cmSystemTools::CollapseFullPath(
i->c_str(), rootBuildDirectory.c_str());
bool const inBuildDir = cmSystemTools::IsSubDirectory(absDepPath.c_str(),
rootBuildDirectory.c_str());
if(inBuildDir)
{
cmNinjaDeps deps(1,*i); cmNinjaDeps deps(1,*i);
this->WritePhonyBuild(os, this->WritePhonyBuild(os,
"", "",
@ -1054,7 +1045,6 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
deps); deps);
} }
} }
}
void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os) void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
{ {