BUG: keep more of the case information

This commit is contained in:
Bill Hoffman 2003-12-23 15:01:10 -05:00
parent 79c23436d3
commit 09ba0a0a31
4 changed files with 74 additions and 18 deletions

View File

@ -73,11 +73,6 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
m_CurrentOutputDirectory = m_Makefile->GetCurrentOutputDirectory();
m_HomeOutputDirectory = m_Makefile->GetHomeOutputDirectory();
m_HomeDirectory = m_Makefile->GetHomeDirectory();
#if defined(_WIN32) || defined(__APPLE__)
m_CurrentOutputDirectory = cmSystemTools::LowerCase(m_CurrentOutputDirectory);
m_HomeOutputDirectory = cmSystemTools::LowerCase(m_HomeOutputDirectory);
m_HomeDirectory = cmSystemTools::LowerCase(m_HomeDirectory);
#endif
if(m_RelativePathToSourceDir.size() == 0)
{
m_RelativePathToSourceDir = cmSystemTools::RelativePath(
@ -102,16 +97,53 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
// Do the work of converting to a relative path
std::string pathIn = p;
#if defined(_WIN32) || defined(__APPLE__)
pathIn = cmSystemTools::LowerCase(pathIn);
#endif
std::string ret = pathIn;
cmSystemTools::ReplaceString(ret, m_CurrentOutputDirectory.c_str(), "");
cmSystemTools::ReplaceString(ret, m_HomeDirectory.c_str(),
m_RelativePathToSourceDir.c_str());
cmSystemTools::ReplaceString(ret, m_HomeOutputDirectory.c_str(),
m_RelativePathToBinaryDir.c_str());
if(m_CurrentOutputDirectory.size() <= ret.size())
{
std::string sub = ret.substr(0, m_CurrentOutputDirectory.size());
if(
#if defined(_WIN32) || defined(__APPLE__)
cmSystemTools::LowerCase(sub) ==
cmSystemTools::LowerCase(m_CurrentOutputDirectory)
#else
sub == m_CurrentOutputDirectory
#endif
)
{
ret = ret.substr(m_CurrentOutputDirectory.size(), ret.npos);
}
}
if(m_HomeDirectory.size() <= ret.size())
{
std::string sub = ret.substr(0, m_HomeDirectory.size());
if(
#if defined(_WIN32) || defined(__APPLE__)
cmSystemTools::LowerCase(sub) ==
cmSystemTools::LowerCase(m_HomeDirectory)
#else
sub == m_HomeDirectory
#endif
)
{
ret = m_RelativePathToSourceDir + ret.substr(m_HomeDirectory.size(), ret.npos);
}
}
if(m_HomeOutputDirectory.size() <= ret.size())
{
std::string sub = ret.substr(0, m_HomeOutputDirectory.size());
if(
#if defined(_WIN32) || defined(__APPLE__)
cmSystemTools::LowerCase(sub) ==
cmSystemTools::LowerCase(m_HomeOutputDirectory)
#else
sub == m_HomeOutputDirectory
#endif
)
{
ret = m_RelativePathToBinaryDir + ret.substr(m_HomeOutputDirectory.size(), ret.npos);
}
}
std::string relpath = m_RelativePathToBinaryDir;
if(relpath.size())
{
@ -121,7 +153,14 @@ std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
{
relpath = ".";
}
if(ret == m_HomeOutputDirectoryNoSlash)
if(
#if defined(_WIN32) || defined(__APPLE__)
cmSystemTools::LowerCase(ret) ==
cmSystemTools::LowerCase(m_HomeOutputDirectoryNoSlash)
#else
ret == m_HomeOutputDirectoryNoSlash
#endif
)
{
ret = relpath;
}

View File

@ -15,9 +15,9 @@
=========================================================================*/
#include "cmTryCompileCommand.h"
#include "cmake.h"
#include "cmCacheManager.h"
#include "cmListFileCache.h"
#include <cmsys/Directory.hxx>
int cmTryCompileCommand::CoreTryCompileCode(
@ -236,9 +236,11 @@ int cmTryCompileCommand::CoreTryCompileCode(
if (srcFileSignature && clean)
{
cmListFileCache::GetInstance()->FlushCache(outFileName.c_str());
cmTryCompileCommand::CleanupFiles(binaryDirectory);
if(!mf->GetCMakeInstance()->GetDebugTryCompile())
{
cmTryCompileCommand::CleanupFiles(binaryDirectory);
}
}
return res;
}
@ -266,6 +268,7 @@ void cmTryCompileCommand::CleanupFiles(const char* binDir)
{
return;
}
std::string bdir = binDir;
if(bdir.find("CMakeTmp") == std::string::npos)
{

View File

@ -64,6 +64,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
cmake::cmake()
{
m_DebugTryCompile = false;
#ifdef __APPLE__
struct rlimit rlp;
if(!getrlimit(RLIMIT_STACK, &rlp))
@ -320,6 +321,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
{
// skip for now
}
else if(arg.find("--debug-trycompile",0) == 0)
{
std::cout << "debug trycompile on\n";
this->DebugTryCompileOn();
}
else if(arg.find("-G",0) == 0)
{
std::string value = arg.substr(2);

View File

@ -1,3 +1,5 @@
#ifndef cmake_h
#define cmake_h
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
@ -252,6 +254,10 @@ class cmake
void SetScriptMode(bool mode) { m_ScriptMode = mode; }
bool GetScriptMode() { return m_ScriptMode; }
///! Debug the try compile stuff by not delelting the files
bool GetDebugTryCompile(){return m_DebugTryCompile;}
void DebugTryCompileOn(){m_DebugTryCompile = true;}
protected:
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
typedef std::map<cmStdString, CreateGeneratorFunctionType> RegisteredGeneratorsMap;
@ -294,6 +300,7 @@ private:
std::string m_CMakeCommand;
const char* m_CXXEnvironment;
const char* m_CCEnvironment;
bool m_DebugTryCompile;
};
#define CMAKE_STANDARD_OPTIONS_TABLE \
@ -323,3 +330,4 @@ private:
"included in each directory of a source tree with the name CMakeLists.txt. " \
"Users build a project by using CMake to generate a build system " \
"for a native tool on their platform.", 0}
#endif