Fix the current directory check for NMake

This commit is contained in:
Andy Cedilnik 2001-11-21 11:35:01 -05:00
parent 94c828bd1f
commit 66135bee42
1 changed files with 25 additions and 8 deletions

View File

@ -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
}
}