diff options
-rw-r--r-- | Source/cmCacheManager.cxx | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 3d6ac98..9ba01db 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -46,6 +46,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "cmRegularExpression.h" #include "stdio.h" +#if defined(_WIN32) || defined(__CYGWIN__) +# include <windows.h> +#endif // _WIN32 + const char* cmCacheManagerTypes[] = { "BOOL", "PATH", @@ -252,14 +256,27 @@ bool cmCacheManager::LoadCache(const char* path, if(cmSystemTools::CollapseFullPath(oldcwd.c_str()) != cmSystemTools::CollapseFullPath(currentcwd.c_str())) { - std::string message = - std::string("The current CMakeCache.txt directory ") + - currentcwd + std::string(" is different than the directory ") + - std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + - std::string(" where CMackeCache.txt was created. This may result " - "in binaries being created in the wrong place. If you " - "are not sure, reedit the CMakeCache.txt"); - cmSystemTools::Error(message.c_str()); +#if defined(_WIN32) || defined(__CYGWIN__) + char filename1[1024]; + char filename2[1024]; + GetShortPathName(cmSystemTools::CollapseFullPath(oldcwd.c_str()).c_str(), + filename1, 1023); + GetShortPathName(cmSystemTools::CollapseFullPath(currentcwd.c_str()).c_str(), + filename2, 1023); + if ( std::string(filename1) != std::string(filename2) ) + { +#endif // _WIN32 + std::string message = + std::string("The current CMakeCache.txt directory ") + + currentcwd + std::string(" is different than the directory ") + + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + + std::string(" where CMackeCache.txt was created. This may result " + "in binaries being created in the wrong place. If you " + "are not sure, reedit the CMakeCache.txt"); + cmSystemTools::Error(message.c_str()); +#if defined(_WIN32) || defined(__CYGWIN__) + } +#endif // _WIN32 } } |