ENH: move relative path to parent generator class
This commit is contained in:
parent
a5fa6e2fe2
commit
d79e3ae698
@ -54,9 +54,75 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg)
|
|||||||
gg->GetCMakeInstance()->GetHomeDirectory());
|
gg->GetCMakeInstance()->GetHomeDirectory());
|
||||||
m_Makefile->SetHomeOutputDirectory(
|
m_Makefile->SetHomeOutputDirectory(
|
||||||
gg->GetCMakeInstance()->GetHomeOutputDirectory());
|
gg->GetCMakeInstance()->GetHomeOutputDirectory());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmLocalGenerator::ConfigureFinalPass()
|
void cmLocalGenerator::ConfigureFinalPass()
|
||||||
{
|
{
|
||||||
m_Makefile->ConfigureFinalPass();
|
m_Makefile->ConfigureFinalPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmLocalGenerator::ConvertToRelativeOutputPath(const char* p)
|
||||||
|
{
|
||||||
|
// The first time this is called, initialize all
|
||||||
|
// the path ivars that are used. This can not
|
||||||
|
// be moved to the constructor because all the paths are not set yet.
|
||||||
|
if(m_CurrentOutputDirectory.size() == 0)
|
||||||
|
{
|
||||||
|
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(
|
||||||
|
m_CurrentOutputDirectory.c_str(),
|
||||||
|
m_HomeDirectory.c_str());
|
||||||
|
std::string path = m_CurrentOutputDirectory;
|
||||||
|
cmSystemTools::ReplaceString(path, m_HomeOutputDirectory.c_str(), "");
|
||||||
|
unsigned i;
|
||||||
|
m_RelativePathToBinaryDir = "";
|
||||||
|
for(i =0; i < path.size(); ++i)
|
||||||
|
{
|
||||||
|
if(path[i] == '/')
|
||||||
|
{
|
||||||
|
m_RelativePathToBinaryDir += "../";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_HomeOutputDirectoryNoSlash = m_HomeOutputDirectory;
|
||||||
|
m_HomeOutputDirectory += "/";
|
||||||
|
m_CurrentOutputDirectory += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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());
|
||||||
|
std::string relpath = m_RelativePathToBinaryDir;
|
||||||
|
if(relpath.size())
|
||||||
|
{
|
||||||
|
relpath.erase(relpath.size()-1, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
relpath = ".";
|
||||||
|
}
|
||||||
|
cmSystemTools::ReplaceString(ret, m_HomeOutputDirectoryNoSlash.c_str(),
|
||||||
|
relpath.c_str());
|
||||||
|
ret = cmSystemTools::ConvertToOutputPath(ret.c_str());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -65,11 +65,19 @@ public:
|
|||||||
|
|
||||||
///! Set the Global Generator, done on creation by the GlobalGenerator
|
///! Set the Global Generator, done on creation by the GlobalGenerator
|
||||||
void SetGlobalGenerator(cmGlobalGenerator *gg);
|
void SetGlobalGenerator(cmGlobalGenerator *gg);
|
||||||
|
std::string ConvertToRelativeOutputPath(const char* p);
|
||||||
protected:
|
protected:
|
||||||
bool m_FromTheTop;
|
bool m_FromTheTop;
|
||||||
cmMakefile *m_Makefile;
|
cmMakefile *m_Makefile;
|
||||||
cmGlobalGenerator *m_GlobalGenerator;
|
cmGlobalGenerator *m_GlobalGenerator;
|
||||||
|
// members used for relative path function ConvertToMakefilePath
|
||||||
|
std::string m_RelativePathToSourceDir;
|
||||||
|
std::string m_RelativePathToBinaryDir;
|
||||||
|
std::string m_CurrentOutputDirectory;
|
||||||
|
std::string m_HomeOutputDirectory;
|
||||||
|
std::string m_HomeDirectory;
|
||||||
|
std::string m_HomeOutputDirectoryNoSlash;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,40 +41,6 @@ cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator()
|
|||||||
|
|
||||||
void cmLocalUnixMakefileGenerator::Generate(bool fromTheTop)
|
void cmLocalUnixMakefileGenerator::Generate(bool fromTheTop)
|
||||||
{
|
{
|
||||||
if(m_CurrentOutputDirectory.size() == 0)
|
|
||||||
{
|
|
||||||
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(
|
|
||||||
m_CurrentOutputDirectory.c_str(),
|
|
||||||
m_HomeDirectory.c_str());
|
|
||||||
std::string path = m_CurrentOutputDirectory;
|
|
||||||
cmSystemTools::ReplaceString(path, m_HomeOutputDirectory.c_str(), "");
|
|
||||||
unsigned i;
|
|
||||||
m_RelativePathToBinaryDir = "";
|
|
||||||
for(i =0; i < path.size(); ++i)
|
|
||||||
{
|
|
||||||
if(path[i] == '/')
|
|
||||||
{
|
|
||||||
m_RelativePathToBinaryDir += "../";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_HomeOutputDirectoryNoSlash = m_HomeOutputDirectory;
|
|
||||||
m_HomeOutputDirectory += "/";
|
|
||||||
m_CurrentOutputDirectory += "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// suppoirt override in output directories
|
// suppoirt override in output directories
|
||||||
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
|
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
|
||||||
{
|
{
|
||||||
@ -256,18 +222,18 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file,
|
|||||||
for(std::vector<std::string>::const_iterator i = lfiles.begin();
|
for(std::vector<std::string>::const_iterator i = lfiles.begin();
|
||||||
i != lfiles.end(); ++i)
|
i != lfiles.end(); ++i)
|
||||||
{
|
{
|
||||||
fout << " " << this->ConvertToMakefilePath(i->c_str());
|
fout << " " << this->ConvertToRelativeOutputPath(i->c_str());
|
||||||
}
|
}
|
||||||
// Add the cache to the list
|
// Add the cache to the list
|
||||||
std::string cacheFile = m_Makefile->GetHomeOutputDirectory();
|
std::string cacheFile = m_Makefile->GetHomeOutputDirectory();
|
||||||
cacheFile += "/CMakeCache.txt";
|
cacheFile += "/CMakeCache.txt";
|
||||||
fout << " " << this->ConvertToMakefilePath(cacheFile.c_str());
|
fout << " " << this->ConvertToRelativeOutputPath(cacheFile.c_str());
|
||||||
fout << "\n\n\n";
|
fout << "\n\n\n";
|
||||||
|
|
||||||
this->OutputMakeVariables(fout);
|
this->OutputMakeVariables(fout);
|
||||||
std::string checkCache = m_Makefile->GetHomeOutputDirectory();
|
std::string checkCache = m_Makefile->GetHomeOutputDirectory();
|
||||||
checkCache += "/cmake.check_cache";
|
checkCache += "/cmake.check_cache";
|
||||||
checkCache = this->ConvertToMakefilePath(checkCache.c_str());
|
checkCache = this->ConvertToRelativeOutputPath(checkCache.c_str());
|
||||||
// most unix makes will pass the command line flags to make down
|
// most unix makes will pass the command line flags to make down
|
||||||
// to sub invoked makes via an environment variable. However, some
|
// to sub invoked makes via an environment variable. However, some
|
||||||
// makes do not support that, so you have to pass the flags explicitly
|
// makes do not support that, so you have to pass the flags explicitly
|
||||||
@ -480,7 +446,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
std::string path2 = m_LibraryOutputPath;
|
std::string path2 = m_LibraryOutputPath;
|
||||||
path2 += this->GetFullTargetName(l->first.c_str(), l->second);
|
path2 += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
path = "... ";
|
path = "... ";
|
||||||
path += this->ConvertToMakefilePath(path2.c_str());
|
path += this->ConvertToRelativeOutputPath(path2.c_str());
|
||||||
this->OutputEcho(fout,path.c_str());
|
this->OutputEcho(fout,path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -525,7 +491,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
path = m_LibraryOutputPath;
|
path = m_LibraryOutputPath;
|
||||||
path += this->GetFullTargetName(l->first.c_str(), l->second);
|
path += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
fout << " \\\n"
|
fout << " \\\n"
|
||||||
<< this->ConvertToMakefilePath(path.c_str());
|
<< this->ConvertToRelativeOutputPath(path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -539,7 +505,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
path = m_ExecutableOutputPath;
|
path = m_ExecutableOutputPath;
|
||||||
path += this->GetFullTargetName(l->first.c_str(), l->second);
|
path += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
fout << " \\\n" << this->ConvertToMakefilePath(path.c_str());
|
fout << " \\\n" << this->ConvertToRelativeOutputPath(path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// list utilities last
|
// list utilities last
|
||||||
@ -572,7 +538,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
if(outExt.size())
|
if(outExt.size())
|
||||||
{
|
{
|
||||||
fout << "\\\n"
|
fout << "\\\n"
|
||||||
<< this->ConvertToMakefilePath((*i)->GetSourceName().c_str())
|
<< this->ConvertToRelativeOutputPath((*i)->GetSourceName().c_str())
|
||||||
<< outExt.c_str() << " ";
|
<< outExt.c_str() << " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,7 +554,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
|
std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
|
||||||
if(outExt.size())
|
if(outExt.size())
|
||||||
{
|
{
|
||||||
fout << "\\\n\"" << this->ConvertToMakefilePath((*i)->GetSourceName().c_str())
|
fout << "\\\n\"" << this->ConvertToRelativeOutputPath((*i)->GetSourceName().c_str())
|
||||||
<< outExt.c_str() << "\" ";
|
<< outExt.c_str() << "\" ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,7 +586,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
path = m_LibraryOutputPath;
|
path = m_LibraryOutputPath;
|
||||||
path += targetNameSO;
|
path += targetNameSO;
|
||||||
fout << " \\\n"
|
fout << " \\\n"
|
||||||
<< this->ConvertToMakefilePath(path.c_str());
|
<< this->ConvertToRelativeOutputPath(path.c_str());
|
||||||
}
|
}
|
||||||
if(targetNameReal != targetName &&
|
if(targetNameReal != targetName &&
|
||||||
targetNameReal != targetNameSO)
|
targetNameReal != targetNameSO)
|
||||||
@ -628,7 +594,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
path = m_LibraryOutputPath;
|
path = m_LibraryOutputPath;
|
||||||
path += targetNameReal;
|
path += targetNameReal;
|
||||||
fout << " \\\n"
|
fout << " \\\n"
|
||||||
<< this->ConvertToMakefilePath(path.c_str());
|
<< this->ConvertToRelativeOutputPath(path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,7 +865,7 @@ std::string cmLocalUnixMakefileGenerator::CreatePreBuildRules(
|
|||||||
{
|
{
|
||||||
initNext = true;
|
initNext = true;
|
||||||
}
|
}
|
||||||
std::string command = this->ConvertToMakefilePath(cc.GetCommand().c_str());
|
std::string command = this->ConvertToRelativeOutputPath(cc.GetCommand().c_str());
|
||||||
customRuleCode += command + " " + cc.GetArguments();
|
customRuleCode += command + " " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
return customRuleCode;
|
return customRuleCode;
|
||||||
@ -924,7 +890,7 @@ std::string cmLocalUnixMakefileGenerator::CreatePreLinkRules(
|
|||||||
{
|
{
|
||||||
initNext = true;
|
initNext = true;
|
||||||
}
|
}
|
||||||
std::string command = this->ConvertToMakefilePath(cc.GetCommand().c_str());
|
std::string command = this->ConvertToRelativeOutputPath(cc.GetCommand().c_str());
|
||||||
customRuleCode += command + " " + cc.GetArguments();
|
customRuleCode += command + " " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
return customRuleCode;
|
return customRuleCode;
|
||||||
@ -949,7 +915,7 @@ std::string cmLocalUnixMakefileGenerator::CreatePostBuildRules(
|
|||||||
{
|
{
|
||||||
initNext = true;
|
initNext = true;
|
||||||
}
|
}
|
||||||
std::string command = this->ConvertToMakefilePath(cc.GetCommand().c_str());
|
std::string command = this->ConvertToRelativeOutputPath(cc.GetCommand().c_str());
|
||||||
customRuleCode += command + " " + cc.GetArguments();
|
customRuleCode += command + " " + cc.GetArguments();
|
||||||
}
|
}
|
||||||
return customRuleCode;
|
return customRuleCode;
|
||||||
@ -1104,10 +1070,10 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout,
|
|||||||
std::string targetFullPathSO = m_LibraryOutputPath + targetNameSO;
|
std::string targetFullPathSO = m_LibraryOutputPath + targetNameSO;
|
||||||
std::string targetFullPathReal = m_LibraryOutputPath + targetNameReal;
|
std::string targetFullPathReal = m_LibraryOutputPath + targetNameReal;
|
||||||
std::string targetFullPathBase = m_LibraryOutputPath + targetNameBase;
|
std::string targetFullPathBase = m_LibraryOutputPath + targetNameBase;
|
||||||
targetFullPath = this->ConvertToMakefilePath(targetFullPath.c_str());
|
targetFullPath = this->ConvertToRelativeOutputPath(targetFullPath.c_str());
|
||||||
targetFullPathSO = this->ConvertToMakefilePath(targetFullPathSO.c_str());
|
targetFullPathSO = this->ConvertToRelativeOutputPath(targetFullPathSO.c_str());
|
||||||
targetFullPathReal = this->ConvertToMakefilePath(targetFullPathReal.c_str());
|
targetFullPathReal = this->ConvertToRelativeOutputPath(targetFullPathReal.c_str());
|
||||||
targetFullPathBase = this->ConvertToMakefilePath(targetFullPathBase.c_str());
|
targetFullPathBase = this->ConvertToRelativeOutputPath(targetFullPathBase.c_str());
|
||||||
|
|
||||||
// get the objects that are used to link this library
|
// get the objects that are used to link this library
|
||||||
std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
||||||
@ -1231,7 +1197,7 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
|
|||||||
if((*i)->GetSourceExtension() == "def")
|
if((*i)->GetSourceExtension() == "def")
|
||||||
{
|
{
|
||||||
linkFlags += this->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
|
linkFlags += this->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
|
||||||
linkFlags += this->ConvertToMakefilePath((*i)->GetFullPath().c_str());
|
linkFlags += this->ConvertToRelativeOutputPath((*i)->GetFullPath().c_str());
|
||||||
linkFlags += " ";
|
linkFlags += " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1335,7 +1301,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
|||||||
}
|
}
|
||||||
target += name;
|
target += name;
|
||||||
target += cmSystemTools::GetExecutableExtension();
|
target += cmSystemTools::GetExecutableExtension();
|
||||||
target = this->ConvertToMakefilePath(target.c_str());
|
target = this->ConvertToRelativeOutputPath(target.c_str());
|
||||||
bool needsLocalTarget = false;
|
bool needsLocalTarget = false;
|
||||||
if(target.find('/') != target.npos)
|
if(target.find('/') != target.npos)
|
||||||
{
|
{
|
||||||
@ -1445,7 +1411,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
|||||||
depend = target;
|
depend = target;
|
||||||
target = name;
|
target = name;
|
||||||
target += cmSystemTools::GetExecutableExtension();
|
target += cmSystemTools::GetExecutableExtension();
|
||||||
target = this->ConvertToMakefilePath(target.c_str());
|
target = this->ConvertToRelativeOutputPath(target.c_str());
|
||||||
commands.resize(0);
|
commands.resize(0);
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
comment.c_str(),
|
comment.c_str(),
|
||||||
@ -1492,7 +1458,7 @@ void cmLocalUnixMakefileGenerator::OutputUtilityRule(std::ostream& fout,
|
|||||||
depends += " \\\n";
|
depends += " \\\n";
|
||||||
replaceVars = *d;
|
replaceVars = *d;
|
||||||
m_Makefile->ExpandVariablesInString(replaceVars);
|
m_Makefile->ExpandVariablesInString(replaceVars);
|
||||||
depends += this->ConvertToMakefilePath(replaceVars.c_str());
|
depends += this->ConvertToRelativeOutputPath(replaceVars.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->OutputMakeRule(fout, comment.c_str(), name,
|
this->OutputMakeRule(fout, comment.c_str(), name,
|
||||||
@ -1750,7 +1716,7 @@ void cmLocalUnixMakefileGenerator::OutputBuildTargetInDir(std::ostream& fout,
|
|||||||
<< "; $(MAKE) $(MAKESILENT) cmake.check_depends"
|
<< "; $(MAKE) $(MAKESILENT) cmake.check_depends"
|
||||||
<< "; $(MAKE) $(MAKESILENT) -f cmake.check_depends"
|
<< "; $(MAKE) $(MAKESILENT) -f cmake.check_depends"
|
||||||
<< "; $(MAKE) $(MAKESILENT) "
|
<< "; $(MAKE) $(MAKESILENT) "
|
||||||
<< this->ConvertToMakefilePath(makeTarget) << "\n\n";
|
<< this->ConvertToRelativeOutputPath(makeTarget) << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1821,7 +1787,7 @@ void cmLocalUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
|
|||||||
libpath += name;
|
libpath += name;
|
||||||
libpath += this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
|
libpath += this->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
|
||||||
}
|
}
|
||||||
fout << this->ConvertToMakefilePath(libpath.c_str()) << " ";
|
fout << this->ConvertToRelativeOutputPath(libpath.c_str()) << " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1860,7 +1826,7 @@ void cmLocalUnixMakefileGenerator::OutputExeDepend(std::ostream& fout,
|
|||||||
exepath += name;
|
exepath += name;
|
||||||
// add the correct extension
|
// add the correct extension
|
||||||
exepath += cmSystemTools::GetExecutableExtension();
|
exepath += cmSystemTools::GetExecutableExtension();
|
||||||
fout << this->ConvertToMakefilePath(exepath.c_str()) << " ";
|
fout << this->ConvertToRelativeOutputPath(exepath.c_str()) << " ";
|
||||||
}
|
}
|
||||||
// if it isn't in the cache, it might still be a utility target
|
// if it isn't in the cache, it might still be a utility target
|
||||||
// so check for that
|
// so check for that
|
||||||
@ -1959,7 +1925,7 @@ void cmLocalUnixMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string directory = this->ConvertToMakefilePath(dir);
|
std::string directory = this->ConvertToRelativeOutputPath(dir);
|
||||||
if(target1)
|
if(target1)
|
||||||
{
|
{
|
||||||
fout << "\t@if test ! -d " << directory
|
fout << "\t@if test ! -d " << directory
|
||||||
@ -2106,8 +2072,8 @@ bool cmLocalUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
std::string s = (*source)->GetSourceName();
|
std::string s = (*source)->GetSourceName();
|
||||||
s += this->GetOutputExtension((*source)->GetSourceExtension().c_str());
|
s += this->GetOutputExtension((*source)->GetSourceExtension().c_str());
|
||||||
fout << this->ConvertToMakefilePath(s.c_str()) << " : "
|
fout << this->ConvertToRelativeOutputPath(s.c_str()) << " : "
|
||||||
<< this->ConvertToMakefilePath(dep->c_str()) << "\n";
|
<< this->ConvertToRelativeOutputPath(dep->c_str()) << "\n";
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
@ -2158,7 +2124,7 @@ void cmLocalUnixMakefileGenerator::OutputCheckDepends(std::ostream& fout)
|
|||||||
// has been done because m_FullPath on cmDependInformation
|
// has been done because m_FullPath on cmDependInformation
|
||||||
// always is it called. If it is called here, network builds are
|
// always is it called. If it is called here, network builds are
|
||||||
// very slow because of the number of stats
|
// very slow because of the number of stats
|
||||||
std::string dependfile = this->ConvertToMakefilePath(dep->c_str());
|
std::string dependfile = this->ConvertToRelativeOutputPath(dep->c_str());
|
||||||
// use the lower path function to create uniqe names
|
// use the lower path function to create uniqe names
|
||||||
std::string lowerpath = this->LowerCasePath(dependfile.c_str());
|
std::string lowerpath = this->LowerCasePath(dependfile.c_str());
|
||||||
if(emittedLowerPath.insert(lowerpath).second)
|
if(emittedLowerPath.insert(lowerpath).second)
|
||||||
@ -2212,7 +2178,7 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
|
|||||||
std::string comment = c->GetComment();
|
std::string comment = c->GetComment();
|
||||||
std::string command = c->GetCommand();
|
std::string command = c->GetCommand();
|
||||||
cmSystemTools::ReplaceString(command, "/./", "/");
|
cmSystemTools::ReplaceString(command, "/./", "/");
|
||||||
command = this->ConvertToMakefilePath(command.c_str());
|
command = this->ConvertToRelativeOutputPath(command.c_str());
|
||||||
command += " ";
|
command += " ";
|
||||||
// now add the arguments
|
// now add the arguments
|
||||||
command += c->GetArguments();
|
command += c->GetArguments();
|
||||||
@ -2243,7 +2209,7 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
|
|||||||
}
|
}
|
||||||
cmSystemTools::ReplaceString(dep, "/./", "/");
|
cmSystemTools::ReplaceString(dep, "/./", "/");
|
||||||
cmSystemTools::ReplaceString(dep, "/$(IntDir)/", "/");
|
cmSystemTools::ReplaceString(dep, "/$(IntDir)/", "/");
|
||||||
dep = this->ConvertToMakefilePath(dep.c_str());
|
dep = this->ConvertToRelativeOutputPath(dep.c_str());
|
||||||
depends += " ";
|
depends += " ";
|
||||||
depends += dep;
|
depends += dep;
|
||||||
}
|
}
|
||||||
@ -2269,7 +2235,7 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
|
|||||||
std::string
|
std::string
|
||||||
cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p)
|
cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p)
|
||||||
{
|
{
|
||||||
std::string ret = this->ConvertToMakefilePath(p);
|
std::string ret = this->ConvertToRelativeOutputPath(p);
|
||||||
// if there are spaces in the path, then get the short path version
|
// if there are spaces in the path, then get the short path version
|
||||||
// if there is one
|
// if there is one
|
||||||
if(ret.find(' ') != std::string::npos)
|
if(ret.find(' ') != std::string::npos)
|
||||||
@ -2278,7 +2244,7 @@ cmLocalUnixMakefileGenerator::ConvertToOutputForExisting(const char* p)
|
|||||||
{
|
{
|
||||||
if(!cmSystemTools::GetShortPath(ret.c_str(), ret))
|
if(!cmSystemTools::GetShortPath(ret.c_str(), ret))
|
||||||
{
|
{
|
||||||
ret = this->ConvertToMakefilePath(p);
|
ret = this->ConvertToRelativeOutputPath(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2325,16 +2291,16 @@ void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fout << "CMAKE_CURRENT_SOURCE = " <<
|
fout << "CMAKE_CURRENT_SOURCE = " <<
|
||||||
this->ConvertToMakefilePath(m_Makefile->GetStartDirectory())
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartDirectory())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
fout << "CMAKE_CURRENT_BINARY = " <<
|
fout << "CMAKE_CURRENT_BINARY = " <<
|
||||||
this->ConvertToMakefilePath(m_Makefile->GetStartOutputDirectory())
|
this->ConvertToRelativeOutputPath(m_Makefile->GetStartOutputDirectory())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
fout << "CMAKE_SOURCE_DIR = " <<
|
fout << "CMAKE_SOURCE_DIR = " <<
|
||||||
this->ConvertToMakefilePath(m_Makefile->GetHomeDirectory())
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
fout << "CMAKE_BINARY_DIR = " <<
|
fout << "CMAKE_BINARY_DIR = " <<
|
||||||
this->ConvertToMakefilePath(m_Makefile->GetHomeOutputDirectory())
|
this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
// Output Include paths
|
// Output Include paths
|
||||||
fout << "INCLUDE_FLAGS = ";
|
fout << "INCLUDE_FLAGS = ";
|
||||||
@ -2427,7 +2393,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
installNameReal += targetNameReal;
|
installNameReal += targetNameReal;
|
||||||
fname = m_LibraryOutputPath;
|
fname = m_LibraryOutputPath;
|
||||||
fname += targetNameReal;
|
fname += targetNameReal;
|
||||||
fout << "\t$(INSTALL_DATA) " << this->ConvertToMakefilePath(fname.c_str())
|
fout << "\t$(INSTALL_DATA) " << this->ConvertToRelativeOutputPath(fname.c_str())
|
||||||
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
||||||
fout << "\t" << cmakecommand << " -E cmake_symlink_library \""
|
fout << "\t" << cmakecommand << " -E cmake_symlink_library \""
|
||||||
<< installNameReal << "\" \"" << installNameSO << "\" \"" << installName
|
<< installNameReal << "\" \"" << installNameSO << "\" \"" << installName
|
||||||
@ -2437,7 +2403,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
fname = m_ExecutableOutputPath;
|
fname = m_ExecutableOutputPath;
|
||||||
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
fname += this->GetFullTargetName(l->first.c_str(), l->second);
|
||||||
fout << "\t$(INSTALL_PROGRAM) " << this->ConvertToMakefilePath(fname.c_str())
|
fout << "\t$(INSTALL_PROGRAM) " << this->ConvertToRelativeOutputPath(fname.c_str())
|
||||||
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::INSTALL_FILES:
|
case cmTarget::INSTALL_FILES:
|
||||||
@ -2471,7 +2437,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
fout << "\t$(INSTALL_DATA) ";
|
fout << "\t$(INSTALL_DATA) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
fout << this->ConvertToMakefilePath(i->c_str())
|
fout << this->ConvertToRelativeOutputPath(i->c_str())
|
||||||
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2506,7 +2472,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
fout << "\t @$(INSTALL_PROGRAM) ";
|
fout << "\t @$(INSTALL_PROGRAM) ";
|
||||||
}
|
}
|
||||||
fout << this->ConvertToMakefilePath(i->c_str())
|
fout << this->ConvertToRelativeOutputPath(i->c_str())
|
||||||
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
<< " \"$(DESTDIR)" << prefix << l->second.GetInstallPath() << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2546,14 +2512,14 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
if(!(*source)->GetPropertyAsBool("HEADER_FILE_ONLY"))
|
if(!(*source)->GetPropertyAsBool("HEADER_FILE_ONLY"))
|
||||||
{
|
{
|
||||||
allsources.push_back(this->ConvertToMakefilePath((*source)->GetFullPath().c_str()));
|
allsources.push_back(this->ConvertToRelativeOutputPath((*source)->GetFullPath().c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string checkCache = m_Makefile->GetHomeOutputDirectory();
|
std::string checkCache = m_Makefile->GetHomeOutputDirectory();
|
||||||
checkCache += "/cmake.check_cache";
|
checkCache += "/cmake.check_cache";
|
||||||
checkCache = this->ConvertToMakefilePath(checkCache.c_str());
|
checkCache = this->ConvertToRelativeOutputPath(checkCache.c_str());
|
||||||
std::vector<std::string> cmake_depends;
|
std::vector<std::string> cmake_depends;
|
||||||
cmake_depends.push_back(checkCache);
|
cmake_depends.push_back(checkCache);
|
||||||
cmake_depends.push_back("$(CMAKE_MAKEFILE_SOURCES)");
|
cmake_depends.push_back("$(CMAKE_MAKEFILE_SOURCES)");
|
||||||
@ -2598,7 +2564,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
|||||||
std::vector<std::string> check_cache_depends;
|
std::vector<std::string> check_cache_depends;
|
||||||
std::string CMakeCache = m_Makefile->GetHomeOutputDirectory();
|
std::string CMakeCache = m_Makefile->GetHomeOutputDirectory();
|
||||||
CMakeCache += "/CMakeCache.txt";
|
CMakeCache += "/CMakeCache.txt";
|
||||||
CMakeCache = this->ConvertToMakefilePath(CMakeCache.c_str());
|
CMakeCache = this->ConvertToRelativeOutputPath(CMakeCache.c_str());
|
||||||
check_cache_depends.push_back(CMakeCache);
|
check_cache_depends.push_back(CMakeCache);
|
||||||
check_cache_depends.push_back("$(CMAKE_MAKEFILE_SOURCES)");
|
check_cache_depends.push_back("$(CMAKE_MAKEFILE_SOURCES)");
|
||||||
|
|
||||||
@ -2703,7 +2669,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
|
|||||||
std::string comment = "object file";
|
std::string comment = "object file";
|
||||||
std::string objectFile = std::string(shortName) +
|
std::string objectFile = std::string(shortName) +
|
||||||
this->GetOutputExtension(source.GetSourceExtension().c_str());
|
this->GetOutputExtension(source.GetSourceExtension().c_str());
|
||||||
objectFile = this->ConvertToMakefilePath(objectFile.c_str());
|
objectFile = this->ConvertToRelativeOutputPath(objectFile.c_str());
|
||||||
cmSystemTools::FileFormat format =
|
cmSystemTools::FileFormat format =
|
||||||
cmSystemTools::GetFileFormat(source.GetSourceExtension().c_str());
|
cmSystemTools::GetFileFormat(source.GetSourceExtension().c_str());
|
||||||
std::vector<std::string> rules;
|
std::vector<std::string> rules;
|
||||||
@ -2713,7 +2679,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
|
|||||||
flags += extraCompileFlags;
|
flags += extraCompileFlags;
|
||||||
}
|
}
|
||||||
std::string sourceFile =
|
std::string sourceFile =
|
||||||
this->ConvertToMakefilePath(source.GetFullPath().c_str());
|
this->ConvertToRelativeOutputPath(source.GetFullPath().c_str());
|
||||||
std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
std::string buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
buildType = cmSystemTools::UpperCase(buildType);
|
buildType = cmSystemTools::UpperCase(buildType);
|
||||||
switch(format)
|
switch(format)
|
||||||
@ -2821,7 +2787,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
|
|||||||
for(std::vector<std::string>::iterator i = depends.begin();
|
for(std::vector<std::string>::iterator i = depends.begin();
|
||||||
i != depends.end(); ++i)
|
i != depends.end(); ++i)
|
||||||
{
|
{
|
||||||
sourceAndDeps.push_back(this->ConvertToMakefilePath(i->c_str()));
|
sourceAndDeps.push_back(this->ConvertToRelativeOutputPath(i->c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3017,7 +2983,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
|||||||
replace = target;
|
replace = target;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
|
||||||
std::string tgt = this->ConvertToMakefilePath(replace.c_str());
|
std::string tgt = this->ConvertToRelativeOutputPath(replace.c_str());
|
||||||
if(depends.empty())
|
if(depends.empty())
|
||||||
{
|
{
|
||||||
fout << tgt.c_str() << ":\n";
|
fout << tgt.c_str() << ":\n";
|
||||||
@ -3217,30 +3183,3 @@ void cmLocalUnixMakefileGenerator::GetLibraryNames(const char* n,
|
|||||||
baseName = this->GetBaseTargetName(n, t);
|
baseName = this->GetBaseTargetName(n, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmLocalUnixMakefileGenerator::ConvertToMakefilePath(const char* p)
|
|
||||||
{
|
|
||||||
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());
|
|
||||||
std::string relpath = m_RelativePathToBinaryDir;
|
|
||||||
if(relpath.size())
|
|
||||||
{
|
|
||||||
relpath.erase(relpath.size()-1, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
relpath = ".";
|
|
||||||
}
|
|
||||||
cmSystemTools::ReplaceString(ret, m_HomeOutputDirectoryNoSlash.c_str(),
|
|
||||||
relpath.c_str());
|
|
||||||
ret = cmSystemTools::ConvertToOutputPath(ret.c_str());
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
@ -233,7 +233,6 @@ protected:
|
|||||||
void OutputEcho(std::ostream& fout, const char *msg);
|
void OutputEcho(std::ostream& fout, const char *msg);
|
||||||
|
|
||||||
///! final processing for a path to be put in a makefile
|
///! final processing for a path to be put in a makefile
|
||||||
std::string ConvertToMakefilePath(const char* p);
|
|
||||||
protected:
|
protected:
|
||||||
int m_MakefileVariableSize;
|
int m_MakefileVariableSize;
|
||||||
std::map<cmStdString, cmStdString> m_MakeVariableMap;
|
std::map<cmStdString, cmStdString> m_MakeVariableMap;
|
||||||
@ -243,12 +242,6 @@ protected:
|
|||||||
std::string m_MakeSilentFlag;
|
std::string m_MakeSilentFlag;
|
||||||
std::string m_ExecutableOutputPath;
|
std::string m_ExecutableOutputPath;
|
||||||
std::string m_LibraryOutputPath;
|
std::string m_LibraryOutputPath;
|
||||||
std::string m_RelativePathToSourceDir;
|
|
||||||
std::string m_RelativePathToBinaryDir;
|
|
||||||
std::string m_CurrentOutputDirectory;
|
|
||||||
std::string m_HomeOutputDirectory;
|
|
||||||
std::string m_HomeDirectory;
|
|
||||||
std::string m_HomeOutputDirectoryNoSlash;
|
|
||||||
bool m_WindowsShell;
|
bool m_WindowsShell;
|
||||||
bool m_PassMakeflags;
|
bool m_PassMakeflags;
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user