ENH: warning fixes and some first steps in cleaning up the convert code

This commit is contained in:
Ken Martin 2005-05-13 09:54:30 -04:00
parent 9e5315fb54
commit 8c65179339
7 changed files with 152 additions and 142 deletions

View File

@ -491,12 +491,6 @@ void cmGlobalGenerator::ClearEnabledLanguages()
void cmGlobalGenerator::Configure()
{
// Setup the current output directory components for use by
// ConvertToRelativePath.
std::string outdir =
cmSystemTools::CollapseFullPath(m_CMakeInstance->GetHomeOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_HomeOutputDirectoryComponents);
// Delete any existing cmLocalGenerators
unsigned int i;
for (i = 0; i < m_LocalGenerators.size(); ++i)
@ -1094,19 +1088,3 @@ void cmGlobalGenerator::SetupTests()
}
}
}
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::ConvertToHomeRelativePath(const char* remote)
{
return (this->ConvertToRelativePath(m_HomeOutputDirectoryComponents,remote));
}
//----------------------------------------------------------------------------
std::string
cmGlobalGenerator::ConvertToHomeRelativeOutputPath(const char* remote)
{
return cmSystemTools::ConvertToOutputPath
(this->ConvertToRelativePath(m_HomeOutputDirectoryComponents,remote).c_str());
}

View File

@ -138,20 +138,6 @@ public:
std::string ConvertToRelativePath(const std::vector<std::string>& local,
const char* remote);
/**
* Convert the given remote path to a relative path with respect to
* this generator's output directory. The remote path must use
* forward slashes and not already be escaped or quoted.
*/
std::string ConvertToHomeRelativePath(const char* remote);
/**
* Convert to an output path that is relative to the output
* directory. The remote path must use forward slashes and not
* already be escaped or quoted.
*/
std::string ConvertToHomeRelativeOutputPath(const char* remote);
/*
* Determine what program to use for building the project.
*/
@ -165,8 +151,6 @@ protected:
void ConfigureRelativePaths();
void SetupTests();
std::vector<std::string> m_HomeOutputDirectoryComponents;
bool m_ForceUnixPaths;
cmStdString m_FindMakeProgramFile;
cmStdString m_ConfiguredFilesPath;

View File

@ -193,9 +193,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
<< "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
// for each cmMakefile get its list of dependencies
unsigned int i;
std::vector<std::string> lfiles;
for (i = 0; i < m_LocalGenerators.size(); ++i)
for (unsigned int i = 0; i < m_LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
@ -244,13 +243,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// add in all the directory information files
std::string tmpStr;
for (i = 0; i < m_LocalGenerators.size(); ++i)
for (unsigned int i = 0; i < m_LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake";
cmakefileStream
<< " \"" << this->ConvertToHomeRelativePath(tmpStr.c_str()).c_str() << "\"\n";
cmakefileStream << " \"" <<
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
}
cmakefileStream << " )\n\n";
@ -309,8 +308,8 @@ void cmGlobalUnixMakefileGenerator3
iCheckSet.begin();
csIter != iCheckSet.end(); ++csIter)
{
cmakefileStream
<< " \"" << this->ConvertToHomeRelativePath(csIter->c_str()).c_str() << "\"\n";
cmakefileStream << " \"" <<
lg->Convert(csIter->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
}
}
cmakefileStream << " )\n";
@ -511,7 +510,7 @@ cmGlobalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
dir = this->ConvertToHomeRelativeOutputPath(dir.c_str());
dir = lg->Convert(dir.c_str(),cmLocalGenerator::HOME_OUTPUT,cmLocalGenerator::MAKEFILE);
localName = dir;
localName += "/directory";

View File

@ -63,10 +63,20 @@ void cmLocalGenerator::Configure()
}
// Setup the current output directory components for use by
// ConvertToRelativePath.
std::string outdir =
cmSystemTools::CollapseFullPath(m_Makefile->GetCurrentOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_CurrentOutputDirectoryComponents);
// Convert
std::string outdir;
outdir =
cmSystemTools::CollapseFullPath(m_Makefile->GetHomeDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_HomeDirectoryComponents);
outdir =
cmSystemTools::CollapseFullPath(m_Makefile->GetStartDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_StartDirectoryComponents);
outdir =
cmSystemTools::CollapseFullPath(m_Makefile->GetHomeOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_HomeOutputDirectoryComponents);
outdir =
cmSystemTools::CollapseFullPath(m_Makefile->GetStartOutputDirectory());
cmSystemTools::SplitPath(outdir.c_str(), m_StartOutputDirectoryComponents);
// Check whether relative paths should be used for optionally
// relative paths.
@ -466,8 +476,10 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
cmSourceFile& source,
cmTarget& )
{
std::string objectFile = this->ConvertToRelativeOutputPath(ofname);
std::string sourceFile = this->ConvertToOptionallyRelativeOutputPath(source.GetFullPath().c_str());
// std::string objectFile = this->ConvertToRelativeOutputPath(ofname);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
std::string sourceFile =
this->Convert(source.GetFullPath().c_str(),START_OUTPUT,SHELL,true);
std::string varString = "CMAKE_";
varString += lang;
varString += "_COMPILE_OBJECT";
@ -509,7 +521,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
for(std::vector<std::string>::iterator i = depends.begin();
i != depends.end(); ++i)
{
sourceAndDeps.push_back(this->ConvertToRelativeOutputPath(i->c_str()));
sourceAndDeps.push_back(this->Convert(i->c_str(),START_OUTPUT,SHELL));
}
}
#if 0
@ -549,7 +561,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
ofname += (*i)->GetSourceName() + outExt;
objVector.push_back(ofname);
this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target);
objs += this->ConvertToRelativeOutputPath(ofname.c_str());
objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE);
objs += " ";
}
}
@ -878,7 +890,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s,
std::string
cmLocalGenerator::ConvertToOutputForExisting(const char* p)
{
std::string ret = this->ConvertToOptionallyRelativeOutputPath(p);
std::string ret = this->Convert(p, START_OUTPUT, SHELL, true);
// if there are spaces in the path, then get the short path version
// if there is one
if(ret.find(' ') != std::string::npos)
@ -887,7 +899,7 @@ cmLocalGenerator::ConvertToOutputForExisting(const char* p)
{
if(!cmSystemTools::GetShortPath(ret.c_str(), ret))
{
ret = this->ConvertToOptionallyRelativeOutputPath(p);
ret = this->Convert(p,START_OUTPUT,MAKEFILE,true);
}
}
}
@ -1063,7 +1075,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if((*i)->GetSourceExtension() == "def")
{
linkFlags += m_Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->ConvertToRelativeOutputPath((*i)->GetFullPath().c_str());
linkFlags += this->Convert((*i)->GetFullPath().c_str(),START_OUTPUT,MAKEFILE);
linkFlags += " ";
}
}
@ -1407,7 +1419,7 @@ cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines,
{
// Start with the command name.
const cmCustomCommandLine& commandLine = *cl;
script += this->ConvertToRelativeOutputPath(commandLine[0].c_str());
script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
// Add the arguments.
for(unsigned int j=1;j < commandLine.size(); ++j)
@ -1425,9 +1437,7 @@ cmLocalGenerator::ConstructScript(const cmCustomCommandLines& commandLines,
//----------------------------------------------------------------------------
std::string cmLocalGenerator::ConvertToRelativePath(const char* remote)
{
return (m_GlobalGenerator
->ConvertToRelativePath(m_CurrentOutputDirectoryComponents,
remote));
return this->Convert(remote,START_OUTPUT);
}
//----------------------------------------------------------------------------
@ -1444,23 +1454,60 @@ cmLocalGenerator::ConvertToRelativeOutputPath(const char* remote)
std::string
cmLocalGenerator::ConvertToOptionallyRelativePath(const char* remote)
{
if(m_UseRelativePaths)
{
return this->ConvertToRelativePath(remote);
}
else
{
return remote;
}
return this->Convert(remote, START_OUTPUT, UNCHANGED, true);
}
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote)
{
// Convert the path to a relative path.
std::string relative = this->ConvertToOptionallyRelativePath(remote);
// Now convert it to an output path.
return cmSystemTools::ConvertToOutputPath(relative.c_str());
return this->Convert(remote, START_OUTPUT, SHELL, true);
}
//----------------------------------------------------------------------------
std::string cmLocalGenerator::Convert(const char* source,
RelativeRoot relative,
OutputFormat output,
bool optional)
{
// Convert the path to a relative path.
std::string result = source;
if (!optional || m_UseRelativePaths)
{
switch (relative)
{
case HOME:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = m_GlobalGenerator->
ConvertToRelativePath(m_HomeDirectoryComponents, result.c_str());
break;
case START:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = m_GlobalGenerator->
ConvertToRelativePath(m_StartDirectoryComponents, result.c_str());
break;
case HOME_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = m_GlobalGenerator->
ConvertToRelativePath(m_HomeOutputDirectoryComponents, result.c_str());
break;
case START_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = m_GlobalGenerator->
ConvertToRelativePath(m_StartOutputDirectoryComponents, result.c_str());
break;
case FULL:
result = cmSystemTools::CollapseFullPath(result.c_str());
break;
}
}
// Now convert it to an output path.
if (output == MAKEFILE || output == SHELL)
{
result = cmSystemTools::ConvertToOutputPath(result.c_str());
}
return result;
}

View File

@ -76,6 +76,27 @@ public:
///! Set the Global Generator, done on creation by the GlobalGenerator
void SetGlobalGenerator(cmGlobalGenerator *gg);
/**
* Convert something to something else. This is a centralized coversion
* routine used by the generators to handle relative paths and the like.
* The flags determine what is actually done.
*
* relative: treat the argument as a directory and convert it to make it
* relative or full or unchanged. If relative (HOME, START etc) then that
* specifies what it should be relative to.
*
* output: make the result suitable for output to a...
*
* optional: should any relative path operation be controlled by the rel
* path setting
*/
enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
enum OutputFormat { UNCHANGED, MAKEFILE, SHELL };
std::string Convert(const char* source,
RelativeRoot relative,
OutputFormat output = UNCHANGED,
bool optional = false);
/**
* Convert the given remote path to a relative path with respect to
* this generator's output directory. The remote path must use
@ -206,7 +227,10 @@ protected:
// members used for relative path function ConvertToMakefilePath
std::string m_RelativePathToSourceDir;
std::string m_RelativePathToBinaryDir;
std::vector<std::string> m_CurrentOutputDirectoryComponents;
std::vector<std::string> m_HomeDirectoryComponents;
std::vector<std::string> m_StartDirectoryComponents;
std::vector<std::string> m_HomeOutputDirectoryComponents;
std::vector<std::string> m_StartOutputDirectoryComponents;
bool m_ExcludeFromAll;
cmLocalGenerator* m_Parent;
std::vector<cmLocalGenerator*> Children;

View File

@ -205,8 +205,9 @@ void cmLocalUnixMakefileGenerator3::WriteCustomCommands()
this->AppendCleanCommand(commands, cleanFiles);
std::string dir = m_Makefile->GetStartOutputDirectory();
dir += "/CMakeCustomRules.dir/clean";
dir = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), dir.c_str());
dir = cmSystemTools::ConvertToOutputPath(dir.c_str());
//dir = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), dir.c_str());
//dir = cmSystemTools::ConvertToOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,SHELL,false);
this->WriteMakeRule(ruleFileStream2,
"Clean the output of this custom command.",
dir.c_str(), depends, commands);
@ -255,7 +256,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
i != includeDirs.end(); ++i)
{
infoFileStream
<< " \"" << this->ConvertToRelativePath(i->c_str()).c_str() << "\"\n";
<< " \"" << this->Convert(i->c_str(),START_OUTPUT).c_str() << "\"\n";
}
infoFileStream
<< " )\n";
@ -481,7 +482,7 @@ cmLocalUnixMakefileGenerator3
std::string depEcho = "Scanning ";
depEcho += lang;
depEcho += " dependencies of ";
depEcho += this->ConvertToRelativeOutputPath(relativeObj.c_str());
depEcho += this->Convert(relativeObj.c_str(),NONE,SHELL);
this->AppendEcho(commands, depEcho.c_str());
// Add a command to call CMake to scan dependencies. CMake will
@ -493,8 +494,7 @@ cmLocalUnixMakefileGenerator3
<< m_GlobalGenerator->GetName() << "\" "
<< lang << " "
<< relativeObj.c_str() << " "
<< m_GlobalGenerator->ConvertToHomeRelativeOutputPath
(source.GetFullPath().c_str());
<< this->Convert(source.GetFullPath().c_str(),HOME_OUTPUT,SHELL);
commands.push_back(depCmd.str());
// compute the target
@ -535,7 +535,7 @@ cmLocalUnixMakefileGenerator3
// Include the dependencies for the target.
std::string depPath = this->GetHomeRelativeOutputPath();
depPath += depMakeFile;
depMakeFile = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(depPath.c_str());
depMakeFile = this->Convert(depPath.c_str(),HOME_OUTPUT,MAKEFILE);
ruleFileStream
<< "# Include any dependencies generated for this rule.\n"
<< m_IncludeDirective << " "
@ -581,11 +581,10 @@ cmLocalUnixMakefileGenerator3
std::string sourceFile = source.GetFullPath();
if(m_UseRelativePaths)
{
sourceFile = m_GlobalGenerator->ConvertToHomeRelativePath(sourceFile.c_str());
sourceFile = this->Convert(sourceFile.c_str(),HOME_OUTPUT);
}
sourceFile = cmSystemTools::ConvertToOutputPath(sourceFile.c_str());
std::string objectFile =
this->ConvertToRelativeOutputPath(obj.c_str());
sourceFile = this->Convert(sourceFile.c_str(),NONE,SHELL);
std::string objectFile = this->Convert(obj.c_str(),START_OUTPUT,SHELL);
// Construct the build message.
std::string relativeObj = this->GetHomeRelativeOutputPath();
@ -741,7 +740,7 @@ cmLocalUnixMakefileGenerator3
cmSystemTools::MakeDirectory(this->ConvertToFullPath(dir).c_str());
// Convert the output name to a relative path if possible.
std::string output = this->ConvertToRelativePath(cc.GetOutput());
std::string output = this->Convert(cc.GetOutput(),START_OUTPUT);
// Construct the name of the rule file by transforming the output
// name to a valid file name. Since the output is already a file
@ -862,7 +861,7 @@ cmLocalUnixMakefileGenerator3
std::string buildTargetRuleName = dir;
buildTargetRuleName += "/build";
buildTargetRuleName =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(buildTargetRuleName.c_str());
this->Convert(buildTargetRuleName.c_str(),HOME_OUTPUT,MAKEFILE);
this->WriteConvenienceRule(ruleFileStream, target.GetName(),
buildTargetRuleName.c_str());
}
@ -928,7 +927,7 @@ cmLocalUnixMakefileGenerator3
// Construct the left hand side of the rule.
replace = target;
std::string tgt = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(replace.c_str());
std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
tgt = this->ConvertToMakeTarget(tgt.c_str());
const char* space = "";
if(tgt.size() == 1)
@ -952,7 +951,7 @@ cmLocalUnixMakefileGenerator3
dep != depends.end(); ++dep)
{
replace = *dep;
replace = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(replace.c_str());
replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
replace = this->ConvertToMakeTarget(replace.c_str());
os << tgt.c_str() << space << ": " << replace.c_str() << "\n";
}
@ -1016,13 +1015,12 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
<< m_GlobalGenerator->ConvertToHomeRelativeOutputPath
(cmakecommand.c_str()).c_str() << "\n"
<< this->Convert(cmakecommand.c_str(),HOME_OUTPUT,MAKEFILE).c_str() << "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
<< this->ConvertToRelativeOutputPath(cmakecommand.c_str()).c_str()
<< this->Convert(cmakecommand.c_str(),HOME_OUTPUT,SHELL).c_str()
<< " -E remove -f\n"
<< "\n";
@ -1039,13 +1037,12 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The top-level source directory on which CMake was run.\n"
<< "CMAKE_SOURCE_DIR = "
<< this->ConvertToRelativeOutputPath(m_Makefile->GetHomeDirectory())
<< this->Convert(m_Makefile->GetHomeDirectory(), HOME_OUTPUT, SHELL)
<< "\n"
<< "\n";
makefileStream
<< "# The top-level build directory on which CMake was run.\n"
<< "CMAKE_BINARY_DIR = "
<< this->ConvertToRelativeOutputPath(m_Makefile->GetHomeOutputDirectory())
<< "CMAKE_BINARY_DIR = ."
<< "\n"
<< "\n";
}
@ -1064,8 +1061,7 @@ void cmLocalUnixMakefileGenerator3::WriteMainTargetIncludes(std::ostream& makefi
// do the include
std::string dir = m_Makefile->GetStartOutputDirectory();
dir += "/CMakeCustomRules.dir/build.make";
dir = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), dir.c_str());
dir = cmSystemTools::ConvertToOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
makefileStream
<< m_IncludeDirective << " "
<< this->ConvertToOutputForExisting(dir.c_str()).c_str()
@ -1080,8 +1076,7 @@ void cmLocalUnixMakefileGenerator3::WriteMainTargetIncludes(std::ostream& makefi
// do the include
std::string dir = m_Makefile->GetStartOutputDirectory();
dir += "/CMakeCustomRules.dir/clean.make";
dir = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), dir.c_str());
dir = cmSystemTools::ConvertToOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
makefileStream
<< m_IncludeDirective << " "
<< this->ConvertToOutputForExisting(dir.c_str()).c_str()
@ -1162,14 +1157,14 @@ void cmLocalUnixMakefileGenerator3::WriteMainTargetRules(std::ostream& makefileS
dir = lg->GetMakefile()->GetStartOutputDirectory();
dir += "/";
dir += rule;
dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
all_tgts.push_back(dir);
}
dir = m_Makefile->GetStartOutputDirectory();
dir += "/";
dir += rule;
dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
this->WriteMakeRule(makefileStream, 0,
dir.c_str(), all_tgts, no_commands);
@ -1249,7 +1244,7 @@ cmLocalUnixMakefileGenerator3
ctest = m_ExecutableOutputPath;
ctest += "ctest";
ctest += cmSystemTools::GetExecutableExtension();
ctest = this->ConvertToRelativeOutputPath(ctest.c_str());
ctest = this->Convert(ctest.c_str(),START_OUTPUT,SHELL);
}
else
{
@ -1284,7 +1279,7 @@ cmLocalUnixMakefileGenerator3
// executable to install over itself.
cmd = m_ExecutableOutputPath;
cmd += "cmake";
cmd = this->ConvertToRelativeOutputPath(cmd.c_str());
cmd = this->Convert(cmd.c_str(),START_OUTPUT,SHELL);
}
else
{
@ -1363,12 +1358,11 @@ cmLocalUnixMakefileGenerator3
// the --check-build-system flag.
{
// Build command to run CMake to check if anything needs regenerating.
std::string cmakefileName = m_Makefile->GetStartOutputDirectory();
cmakefileName += "/Makefile.cmake";
std::string cmakefileName = "Makefile.cmake";
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
runRule += this->ConvertToRelativeOutputPath(cmakefileName.c_str());
runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL);
std::vector<std::string> no_depends;
std::vector<std::string> commands;
@ -1449,13 +1443,11 @@ cmLocalUnixMakefileGenerator3
dir += this->GetTargetDirectory(target);
std::string targetRequires = dir;
targetRequires += "/requires";
targetRequires =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetRequires.c_str());
targetRequires = this->Convert(targetRequires.c_str(),HOME_OUTPUT,MAKEFILE);
std::string buildTarget = dir;
buildTarget += "/build";
buildTarget =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(buildTarget.c_str());
buildTarget = this->Convert(buildTarget.c_str(),HOME_OUTPUT,MAKEFILE);
std::string comment = "Directory-level requires rule for this target.";
if(provides_requires.empty())
@ -1474,8 +1466,7 @@ cmLocalUnixMakefileGenerator3
// provides-requires mode to build the target itself.
std::string targetProvides = dir;
targetProvides += "/provides";
targetProvides =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetProvides.c_str());
targetProvides = this->Convert(targetProvides.c_str(),HOME_OUTPUT,MAKEFILE);
{
std::vector<std::string> no_commands;
std::vector<std::string> depends;
@ -1559,8 +1550,7 @@ cmLocalUnixMakefileGenerator3
targetFullPath += cmSystemTools::GetExecutableExtension();
// Convert to the output path to use in constructing commands.
std::string targetOutPath =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetFullPath.c_str());
std::string targetOutPath = this->Convert(targetFullPath.c_str(),HOME_OUTPUT,MAKEFILE);
// Get the language to use for linking this executable.
const char* linkLanguage =
@ -1671,7 +1661,7 @@ cmLocalUnixMakefileGenerator3
std::string buildTargetRuleName = dir;
buildTargetRuleName += "/build";
buildTargetRuleName =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(buildTargetRuleName.c_str());
this->Convert(buildTargetRuleName.c_str(),HOME_OUTPUT,MAKEFILE);
this->WriteConvenienceRule(ruleFileStream, targetFullPath.c_str(),
buildTargetRuleName.c_str());
@ -1738,7 +1728,7 @@ cmLocalUnixMakefileGenerator3
extraFlags += " ";
extraFlags += m_Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
extraFlags +=
m_GlobalGenerator->ConvertToHomeRelativeOutputPath((*i)->GetFullPath().c_str());
this->Convert((*i)->GetFullPath().c_str(),HOME_OUTPUT,MAKEFILE);
}
}
}
@ -1864,13 +1854,13 @@ cmLocalUnixMakefileGenerator3
// Construct the output path version of the names for use in command
// arguments.
std::string targetOutPath =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetFullPath.c_str());
this->Convert(targetFullPath.c_str(),HOME_OUTPUT,MAKEFILE);
std::string targetOutPathSO =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetFullPathSO.c_str());
this->Convert(targetFullPathSO.c_str(),HOME_OUTPUT,MAKEFILE);
std::string targetOutPathReal =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetFullPathReal.c_str());
this->Convert(targetFullPathReal.c_str(),HOME_OUTPUT,MAKEFILE);
std::string targetOutPathBase =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(targetFullPathBase.c_str());
this->Convert(targetFullPathBase.c_str(),HOME_OUTPUT,MAKEFILE);
// Add the link message.
std::string buildEcho = "Linking ";
@ -1996,7 +1986,7 @@ cmLocalUnixMakefileGenerator3
std::string buildTargetRuleName = dir;
buildTargetRuleName += "/build";
buildTargetRuleName =
m_GlobalGenerator->ConvertToHomeRelativeOutputPath(buildTargetRuleName.c_str());
this->Convert(buildTargetRuleName.c_str(),HOME_OUTPUT,MAKEFILE);
this->WriteConvenienceRule(ruleFileStream, targetFullPath.c_str(),
buildTargetRuleName.c_str());
@ -2050,7 +2040,7 @@ cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator i = external_objects.begin();
i != external_objects.end(); ++i)
{
std::string object = m_GlobalGenerator->ConvertToHomeRelativePath(i->c_str());
object = this->Convert(i->c_str(),HOME_OUTPUT);
ruleFileStream
<< " \\\n"
<< this->ConvertToQuotedOutputPath(object.c_str());
@ -2213,7 +2203,7 @@ cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(const cmTarget& target
dir += "/";
dir += this->GetTargetDirectory(target);
dir = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), dir.c_str());
return cmSystemTools::ConvertToOutputPath(dir.c_str());
return this->Convert(dir.c_str(),NONE,MAKEFILE);
}
//----------------------------------------------------------------------------
@ -2222,7 +2212,7 @@ cmLocalUnixMakefileGenerator3
::GetSubdirTargetName(const char* pass, const char* subdir)
{
// Convert the subdirectory name to a relative path to keep it short.
std::string reldir = this->ConvertToRelativePath(subdir);
std::string reldir = this->Convert(subdir,START_OUTPUT);
// Convert the subdirectory name to a valid make target name.
std::string s = pass;
@ -2301,17 +2291,6 @@ cmLocalUnixMakefileGenerator3
->GetLanguageFromExtension(source.GetSourceExtension().c_str()));
}
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3::ConvertToRelativeOutputPath(const char* p)
{
// Convert the path to a relative path.
std::string relative = this->ConvertToRelativePath(p);
// Now convert it to an output path.
return cmSystemTools::ConvertToOutputPath(relative.c_str());
}
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
@ -2587,14 +2566,14 @@ cmLocalUnixMakefileGenerator3
const cmCustomCommandLine& commandLine = *cl;
std::string cmd = commandLine[0];
cmSystemTools::ReplaceString(cmd, "/./", "/");
cmd = m_GlobalGenerator->ConvertToHomeRelativePath(cmd.c_str());
cmd = this->Convert(cmd.c_str(),HOME_OUTPUT);
if(cmd.find("/") == cmd.npos &&
commandLine[0].find("/") != cmd.npos)
{
// Add a leading "./" for executables in the current directory.
cmd = "./" + cmd;
}
cmd = cmSystemTools::ConvertToOutputPath(cmd.c_str());
cmd = this->Convert(cmd.c_str(),NONE,SHELL);
for(unsigned int j=1; j < commandLine.size(); ++j)
{
cmd += " ";
@ -2617,7 +2596,7 @@ cmLocalUnixMakefileGenerator3
f != files.end(); ++f)
{
remove += " ";
remove += this->ConvertToRelativeOutputPath(f->c_str());
remove += this->Convert(f->c_str(),START_OUTPUT,SHELL);
}
commands.push_back(remove);
}
@ -3008,7 +2987,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// Write the empty all rule.
std::string dir = m_Makefile->GetStartOutputDirectory();
dir += "/directory";
dir = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(dir.c_str());
dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE);
this->CreateJumpCommand(commands,dir);
this->WriteMakeRule(ruleFileStream, "The main all target", "all", depends, commands);
@ -3170,7 +3149,7 @@ cmLocalUnixMakefileGenerator3
// Add the target.
if (tgt && tgt[0] != '\0')
{
std::string tgt2 = m_GlobalGenerator->ConvertToHomeRelativeOutputPath(tgt);
std::string tgt2 = this->Convert(tgt,HOME_OUTPUT,MAKEFILE);
tgt2 = this->ConvertToMakeTarget(tgt2.c_str());
cmd += tgt2;
}

View File

@ -134,7 +134,6 @@ public:
void WriteSpecialTargetsBottom(std::ostream& makefileStream);
std::string ConvertToRelativeOutputPath(const char* p);
std::string GetRelativeTargetDirectory(const cmTarget& target);
void WriteLocalCleanRule(std::ostream& makefileStream);