summaryrefslogtreecommitdiff
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2016-05-14 01:18:20 +0200
committerBrad King <brad.king@kitware.com>2016-05-17 09:34:12 -0400
commit8a862a4d4b852c9f61ae4ed7fc46042b00a83123 (patch)
tree591906a0300c9619e57394105455d93126dab939 /Source/cmNinjaTargetGenerator.cxx
parent038e7716e58e4cf79bda6ba72b92814a14978a8f (diff)
downloadcmake-8a862a4d4b852c9f61ae4ed7fc46042b00a83123.tar.gz
Ninja: Support embedding of CMake as subninja project
Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 994daeae2a..4d58242a5f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -669,10 +669,12 @@ void cmNinjaTargetGenerator::EnsureDirectoryExists(
if (cmSystemTools::FileIsFullPath(path.c_str())) {
cmSystemTools::MakeDirectory(path.c_str());
} else {
- const std::string fullPath = std::string(this->GetGlobalGenerator()
- ->GetCMakeInstance()
- ->GetHomeOutputDirectory()) +
- "/" + path;
+ cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
+ std::string fullPath =
+ std::string(gg->GetCMakeInstance()->GetHomeOutputDirectory());
+ // Also ensures their is a trailing slash.
+ gg->StripNinjaOutputPathPrefixAsSuffix(fullPath);
+ fullPath += path;
cmSystemTools::MakeDirectory(fullPath.c_str());
}
}