diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2001-10-26 13:29:21 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2001-10-26 13:29:21 (GMT) |
commit | 47c7af3cc885a7ebf2e070667def573af49b673e (patch) | |
tree | ce5a085a3080c1fb58b71a81811df1cdc1447afc /Source/cmCacheManager.cxx | |
parent | 959c447a6d845911d7192c8fbb8f2d321d3a757d (diff) | |
download | CMake-47c7af3cc885a7ebf2e070667def573af49b673e.zip CMake-47c7af3cc885a7ebf2e070667def573af49b673e.tar.gz CMake-47c7af3cc885a7ebf2e070667def573af49b673e.tar.bz2 |
Added check if the binary directory changed. If it did, it will print the warning message
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 9014216..b07ab5f 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -151,9 +151,9 @@ bool cmCacheManager::LoadCache(const char* path, (*realbuffer == ' ' || *realbuffer == '\t' || *realbuffer == '\n')) - { + { realbuffer++; - } + } // skip blank lines and comment lines if(realbuffer[0] == '#' || realbuffer[0] == 0) { @@ -202,38 +202,38 @@ bool cmCacheManager::LoadCache(const char* path, { entryKey = reg.match(1); if ( excludes.find(entryKey) == excludes.end() ) - { - e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str()); - // only load internal values if internal is set - // Load internal values if internal is set. - // If the entry is not internal to the cache being loaded - // or if it is in the list of internal entries to be - // imported, load it. - if ( internal || (e.m_Type != INTERNAL) || - (includes.find(entryKey) != includes.end()) ) - { - // If we are loading the cache from another project, - // make all loaded entries internal so that it is - // not visible in the gui - if (!internal) - { - e.m_Type = INTERNAL; - e.m_HelpString = "DO NOT EDIT, "; + { + e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str()); + // only load internal values if internal is set + // Load internal values if internal is set. + // If the entry is not internal to the cache being loaded + // or if it is in the list of internal entries to be + // imported, load it. + if ( internal || (e.m_Type != INTERNAL) || + (includes.find(entryKey) != includes.end()) ) + { + // If we are loading the cache from another project, + // make all loaded entries internal so that it is + // not visible in the gui + if (!internal) + { + e.m_Type = INTERNAL; + e.m_HelpString = "DO NOT EDIT, "; e.m_HelpString += entryKey; e.m_HelpString += " loaded from external file. " "To change this value edit this file: "; e.m_HelpString += path; e.m_HelpString += "/CMakeCache.txt"; - } - e.m_Value = reg.match(3); - m_Cache[entryKey] = e; - } - } + } + e.m_Value = reg.match(3); + m_Cache[entryKey] = e; + } + } } else { - cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(), - ". Offending entry: ", realbuffer); + cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(), + ". Offending entry: ", realbuffer); } } // if CMAKE version not found in the list file @@ -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" |