Merge topic 'load-cache-msg'

ddf7ebe06e cmake: Friendlier message when trying to --build the wrong dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10305
This commit is contained in:
Brad King
2025-02-09 17:37:52 +00:00
committed by Kitware Robot
3 changed files with 6 additions and 4 deletions

View File

@@ -3850,7 +3850,8 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
std::string cachePath = FindCacheFile(dir);
if (!this->LoadCache(cachePath)) {
std::cerr << "Error: could not load cache\n";
std::cerr
<< "Error: not a CMake build directory (missing CMakeCache.txt)\n";
return 1;
}
cmValue cachedGenerator = this->State->GetCacheEntryValue("CMAKE_GENERATOR");
@@ -3979,7 +3980,8 @@ bool cmake::Open(std::string const& dir, bool dryRun)
std::string cachePath = FindCacheFile(dir);
if (!this->LoadCache(cachePath)) {
std::cerr << "Error: could not load cache\n";
std::cerr
<< "Error: not a CMake build directory (missing CMakeCache.txt)\n";
return false;
}
cmValue genName = this->State->GetCacheEntryValue("CMAKE_GENERATOR");

View File

@@ -1 +1 @@
^Error: could not load cache
^Error: not a CMake build directory \(missing CMakeCache\.txt\)$

View File

@@ -1 +1 @@
^Error: could not load cache$
^Error: not a CMake build directory \(missing CMakeCache\.txt\)$