summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2015-08-15 04:45:53 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2015-08-15 04:46:53 (GMT)
commitba1065ab7b3c293245b3bbe733f8f062b9aa7ac9 (patch)
treed115c98123a0953af6a637a09ad0f2edf7f80beb
parent17ecfd8210b4db74753c4565b10a2b75dfa4c480 (diff)
downloadCMake-ba1065ab7b3c293245b3bbe733f8f062b9aa7ac9.zip
CMake-ba1065ab7b3c293245b3bbe733f8f062b9aa7ac9.tar.gz
CMake-ba1065ab7b3c293245b3bbe733f8f062b9aa7ac9.tar.bz2
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";