diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 20551679ac..1420cb683a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3850,7 +3850,8 @@ int cmake::Build(int jobs, std::string dir, std::vector 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"); diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt index fa3adc8743..1eebfc603f 100644 --- a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt +++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt @@ -1 +1 @@ -^Error: could not load cache +^Error: not a CMake build directory \(missing CMakeCache\.txt\)$ diff --git a/Tests/RunCMake/CommandLine/build-no-cache-stderr.txt b/Tests/RunCMake/CommandLine/build-no-cache-stderr.txt index 40dd3c0979..1eebfc603f 100644 --- a/Tests/RunCMake/CommandLine/build-no-cache-stderr.txt +++ b/Tests/RunCMake/CommandLine/build-no-cache-stderr.txt @@ -1 +1 @@ -^Error: could not load cache$ +^Error: not a CMake build directory \(missing CMakeCache\.txt\)$