Change CMAKE_CURRENT_CWD to CMAKE_CACHEFILE_DIR and change the messages
This commit is contained in:
parent
091e95f26d
commit
f59946de67
@ -250,15 +250,17 @@ bool cmCacheManager::LoadCache(const char* path,
|
|||||||
}
|
}
|
||||||
std::string currentcwd = path;
|
std::string currentcwd = path;
|
||||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||||
if(internal && this->GetCacheValue("CMAKE_CACHE_CWD") &&
|
if(internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") &&
|
||||||
std::string(this->GetCacheValue("CMAKE_CACHE_CWD")) != currentcwd)
|
std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) != currentcwd)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("The current directory is different"
|
std::string message =
|
||||||
" than the one CMake was run before."
|
std::string("The current CMakeCache.txt directory ") +
|
||||||
" The binary files will be created "
|
currentcwd + std::string(" is different than the directory ") +
|
||||||
"in the previous directory. If that "
|
std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
|
||||||
"is not what you want, reedit the "
|
std::string(" where CMackeCache.txt was created. This may result "
|
||||||
"CMakeCache.txt");
|
"in binaries being created in the wrong place. If you "
|
||||||
|
"are not sure, reedit the CMakeCache.txt");
|
||||||
|
cmSystemTools::Error(message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -315,9 +317,9 @@ bool cmCacheManager::SaveCache(const char* path)
|
|||||||
// Copies it, he will not be surprised
|
// Copies it, he will not be surprised
|
||||||
std::string currentcwd = path;
|
std::string currentcwd = path;
|
||||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||||
this->AddCacheEntry("CMAKE_CACHE_CWD", currentcwd.c_str(),
|
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
|
||||||
"This is the directory where cmake was running the"
|
"This is the directory where this CMakeCahe.txt"
|
||||||
" last time", cmCacheManager::INTERNAL);
|
" was created", cmCacheManager::INTERNAL);
|
||||||
|
|
||||||
fout << "# This is the CMakeCache file.\n"
|
fout << "# This is the CMakeCache file.\n"
|
||||||
<< "# For build in directory: " << path << "\n"
|
<< "# For build in directory: " << path << "\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user