summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-18 14:11:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-08-18 14:11:58 (GMT)
commitfb329c0bc130e0afef086d6d154890bdde773e40 (patch)
tree00e2cbac3a2137f1338f128393335c5d7399d7a0
parent76a54a4486e26b893644447a81da11f864c2cc80 (diff)
parentba1065ab7b3c293245b3bbe733f8f062b9aa7ac9 (diff)
downloadCMake-fb329c0bc130e0afef086d6d154890bdde773e40.zip
CMake-fb329c0bc130e0afef086d6d154890bdde773e40.tar.gz
CMake-fb329c0bc130e0afef086d6d154890bdde773e40.tar.bz2
Merge topic 'build-subdir'
ba1065ab cmake: Add support for "--build ." in subdirectory (#15696)
-rw-r--r--Source/cmake.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2855329..62b3f83 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2745,6 +2745,25 @@ int cmake::Build(const std::string& dir,
}
std::string cachePath = dir;
cmSystemTools::ConvertToUnixSlashes(cachePath);
+ std::string cacheFile = cachePath;
+ cacheFile += "/CMakeCache.txt";
+ if(!cmSystemTools::FileExists(cacheFile.c_str()))
+ {
+ // search in parent directories for cache
+ std::string cmakeFiles = cachePath;
+ cmakeFiles += "/CMakeFiles";
+ if(cmSystemTools::FileExists(cmakeFiles.c_str()))
+ {
+ std::string cachePathFound =
+ cmSystemTools::FileExistsInParentDirectories(
+ "CMakeCache.txt", cachePath.c_str(), "/");
+ if(!cachePathFound.empty())
+ {
+ cachePath = cmSystemTools::GetFilenamePath(cachePathFound);
+ }
+ }
+ }
+
if(!this->LoadCache(cachePath))
{
std::cerr << "Error: could not load cache\n";