summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-10-08 12:49:05 (GMT)
committerBrad King <brad.king@kitware.com>2014-10-08 12:50:15 (GMT)
commitde8e534b4141e0300c0329c47387de9635e3024f (patch)
treeb13a4077da73a0d5256c62172af0dcb650957b76 /Source
parent734580a8db6526c90a5f12f42a78adfdb6364887 (diff)
downloadCMake-de8e534b4141e0300c0329c47387de9635e3024f.zip
CMake-de8e534b4141e0300c0329c47387de9635e3024f.tar.gz
CMake-de8e534b4141e0300c0329c47387de9635e3024f.tar.bz2
Ninja: Limit custom command side-effects to build folder
Revert commit 7243c951 (Ninja: Don't limit custom cmd side-effects to build folder, 2014-06-27) because it causes every custom command dependency in the source tree to get a phony rule. For large projects these rules get too big for Ninja to handle efficiently. While the original change addressed a valid concern, it did not seem to occur regularly in practice because well-behaved projects generate their side-effects only in the build tree. Until we support explicit specification of side-effects (CMake issue #14963), we will have to use this as a middle-ground.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index f391203..6e7b06b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1042,17 +1042,27 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
std::back_inserter(unkownExplicitDepends));
+ std::string const rootBuildDirectory =
+ this->GetCMakeInstance()->GetHomeOutputDirectory();
for (std::vector<std::string>::const_iterator
i = unkownExplicitDepends.begin();
i != unkownExplicitDepends.end();
++i)
{
- cmNinjaDeps deps(1,*i);
- this->WritePhonyBuild(os,
- "",
- deps,
- deps);
- }
+ //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);
+ this->WritePhonyBuild(os,
+ "",
+ deps,
+ deps);
+ }
+ }
}
void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)