Fix the problem on windows of capital or lower case drive letter for CMAKE_CACHEFILE_DIR

This commit is contained in:
Andy Cedilnik 2001-10-30 14:36:50 -05:00
parent f59946de67
commit 33b0bca1c4
1 changed files with 10 additions and 0 deletions

View File

@ -249,6 +249,11 @@ bool cmCacheManager::LoadCache(const char* path,
} }
std::string currentcwd = path; std::string currentcwd = path;
if ( currentcwd[0] >= 'A' && currentcwd[0] <= 'Z' &&
currentcwd[1] == ':' )
{
currentcwd[0] = currentcwd[0] - 'A' + 'a';
}
cmSystemTools::ConvertToUnixSlashes(currentcwd); cmSystemTools::ConvertToUnixSlashes(currentcwd);
if(internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") && if(internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") &&
std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) != currentcwd) std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) != currentcwd)
@ -316,6 +321,11 @@ bool cmCacheManager::SaveCache(const char* path)
// Let us store the current working directory so that if somebody // Let us store the current working directory so that if somebody
// Copies it, he will not be surprised // Copies it, he will not be surprised
std::string currentcwd = path; std::string currentcwd = path;
if ( currentcwd[0] >= 'A' && currentcwd[0] <= 'Z' &&
currentcwd[1] == ':' )
{
currentcwd[0] = currentcwd[0] - 'A' + 'a';
}
cmSystemTools::ConvertToUnixSlashes(currentcwd); cmSystemTools::ConvertToUnixSlashes(currentcwd);
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
"This is the directory where this CMakeCahe.txt" "This is the directory where this CMakeCahe.txt"