Added check if the binary directory changed. If it did, it will print the warning message
This commit is contained in:
parent
959c447a6d
commit
47c7af3cc8
@ -248,6 +248,19 @@ bool cmCacheManager::LoadCache(const char* path,
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
|
||||
}
|
||||
std::string currentcwd = path;
|
||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||
if(internal && this->GetCacheValue("CMAKE_CACHE_CWD") &&
|
||||
std::string(this->GetCacheValue("CMAKE_CACHE_CWD")) != currentcwd)
|
||||
{
|
||||
cmSystemTools::Error("The current directory is different"
|
||||
" than the one CMake was run before."
|
||||
" The binary files will be created "
|
||||
"in the previous directory. If that "
|
||||
"is not what you want, reedit the "
|
||||
"CMakeCache.txt");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -297,6 +310,15 @@ bool cmCacheManager::SaveCache(const char* path)
|
||||
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
|
||||
"Major version of cmake used to create the "
|
||||
"current loaded cache", cmCacheManager::INTERNAL);
|
||||
|
||||
// Let us store the current working directory so that if somebody
|
||||
// Copies it, he will not be surprised
|
||||
std::string currentcwd = path;
|
||||
cmSystemTools::ConvertToUnixSlashes(currentcwd);
|
||||
this->AddCacheEntry("CMAKE_CACHE_CWD", currentcwd.c_str(),
|
||||
"This is the directory where cmake was running the"
|
||||
" last time", cmCacheManager::INTERNAL);
|
||||
|
||||
fout << "# This is the CMakeCache file.\n"
|
||||
<< "# For build in directory: " << path << "\n"
|
||||
<< "# You can edit this file to change values found and used by cmake.\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user