Commit 20e62f74 authored by Stephen Kelly's avatar Stephen Kelly

cmLocalGenerator: Simplify ConvertToLinkReference

Make conversion to output format the caller responsibility, so that the
method only 'converts to a link reference'.
parent fd93b360
Pipeline #29734 passed with stage
......@@ -75,8 +75,10 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
// Append the flag and value. Use ConvertToLinkReference to help
// vs6's "cl -link" pass it to the linker.
std::string flag = defFileFlag;
flag += (this->LocalGenerator->ConvertToLinkReference(
this->ModuleDefinitionFile->GetFullPath()));
flag += this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->ConvertToLinkReference(
this->ModuleDefinitionFile->GetFullPath()),
cmOutputConverter::SHELL);
this->LocalGenerator->AppendFlags(flags, flag);
}
......
......@@ -1374,8 +1374,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
return std::string();
}
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
OutputFormat format)
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
// Work-ardound command line parsing limitations in MSVC 6.0
......@@ -1392,17 +1391,14 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
// Append the rest of the path with no space.
sp += lib.substr(pos);
// Convert to an output path.
return this->ConvertToOutputFormat(sp.c_str(), format);
return sp;
}
}
}
#endif
// Normal behavior.
return this->ConvertToOutputFormat(
this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib),
format);
return this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib);
}
/**
......@@ -1517,7 +1513,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
continue;
}
if (li->IsPath) {
linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
linkLibs += this->ConvertToOutputFormat(
this->ConvertToLinkReference(li->Value), shellFormat);
} else {
linkLibs += li->Value;
}
......
......@@ -367,9 +367,7 @@ protected:
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
virtual std::string ConvertToLinkReference(
std::string const& lib,
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
virtual std::string ConvertToLinkReference(std::string const& lib);
/** Check whether the native build system supports the given
definition. Issues a warning. */
......
......@@ -121,10 +121,9 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
// Virtual protected methods.
std::string cmLocalNinjaGenerator::ConvertToLinkReference(
std::string const& lib, cmOutputConverter::OutputFormat format)
std::string const& lib)
{
std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
return this->ConvertToOutputFormat(path, format);
return this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
}
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
......
......@@ -76,9 +76,7 @@ public:
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
cmNinjaDeps& ninjaDeps);
std::string ConvertToLinkReference(std::string const& lib,
cmOutputConverter::OutputFormat format =
cmOutputConverter::SHELL) CM_OVERRIDE;
std::string ConvertToLinkReference(std::string const& lib) CM_OVERRIDE;
void ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment