summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-10-09 20:12:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-10-09 20:12:01 (GMT)
commit4c02746372c71ddcc08935e6c41ff34b59e9926d (patch)
treed6b90769b7a80b548941e8a6541465c8d5879555 /Source
parenta358448d3ebbb28bd2fd16b9dbed4d473867d20c (diff)
parentde8e534b4141e0300c0329c47387de9635e3024f (diff)
downloadCMake-4c02746372c71ddcc08935e6c41ff34b59e9926d.zip
CMake-4c02746372c71ddcc08935e6c41ff34b59e9926d.tar.gz
CMake-4c02746372c71ddcc08935e6c41ff34b59e9926d.tar.bz2
Merge topic 'ninja-phony-rules-only-in-build-tree'
de8e534b Ninja: Limit custom command side-effects to build folder
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)