Sfoglia il codice sorgente

Fix the current directory check for NMake

Andy Cedilnik 24 anni fa
parent
commit
66135bee42
1 ha cambiato i file con 25 aggiunte e 8 eliminazioni
  1. 25 8
      Source/cmCacheManager.cxx

+ 25 - 8
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
       }
     }