mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-24 11:32:44 +08:00
cmLocalGenerator: Simplify ConvertToLinkReference
Make conversion to output format the caller responsibility, so that the method only 'converts to a link reference'.
This commit is contained in:
@@ -75,8 +75,10 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
|
|||||||
// Append the flag and value. Use ConvertToLinkReference to help
|
// Append the flag and value. Use ConvertToLinkReference to help
|
||||||
// vs6's "cl -link" pass it to the linker.
|
// vs6's "cl -link" pass it to the linker.
|
||||||
std::string flag = defFileFlag;
|
std::string flag = defFileFlag;
|
||||||
flag += (this->LocalGenerator->ConvertToLinkReference(
|
flag += this->LocalGenerator->ConvertToOutputFormat(
|
||||||
this->ModuleDefinitionFile->GetFullPath()));
|
this->LocalGenerator->ConvertToLinkReference(
|
||||||
|
this->ModuleDefinitionFile->GetFullPath()),
|
||||||
|
cmOutputConverter::SHELL);
|
||||||
this->LocalGenerator->AppendFlags(flags, flag);
|
this->LocalGenerator->AppendFlags(flags, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1374,8 +1374,7 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
|
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
|
||||||
OutputFormat format)
|
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
// Work-ardound command line parsing limitations in MSVC 6.0
|
// 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.
|
// Append the rest of the path with no space.
|
||||||
sp += lib.substr(pos);
|
sp += lib.substr(pos);
|
||||||
|
|
||||||
// Convert to an output path.
|
return sp;
|
||||||
return this->ConvertToOutputFormat(sp.c_str(), format);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Normal behavior.
|
// Normal behavior.
|
||||||
return this->ConvertToOutputFormat(
|
return this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib);
|
||||||
this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), lib),
|
|
||||||
format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1517,7 +1513,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (li->IsPath) {
|
if (li->IsPath) {
|
||||||
linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
|
linkLibs += this->ConvertToOutputFormat(
|
||||||
|
this->ConvertToLinkReference(li->Value), shellFormat);
|
||||||
} else {
|
} else {
|
||||||
linkLibs += li->Value;
|
linkLibs += li->Value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,9 +367,7 @@ protected:
|
|||||||
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
|
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
|
||||||
std::string const& dir_max);
|
std::string const& dir_max);
|
||||||
|
|
||||||
virtual std::string ConvertToLinkReference(
|
virtual std::string ConvertToLinkReference(std::string const& lib);
|
||||||
std::string const& lib,
|
|
||||||
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL);
|
|
||||||
|
|
||||||
/** Check whether the native build system supports the given
|
/** Check whether the native build system supports the given
|
||||||
definition. Issues a warning. */
|
definition. Issues a warning. */
|
||||||
|
|||||||
@@ -121,10 +121,9 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator()
|
|||||||
// Virtual protected methods.
|
// Virtual protected methods.
|
||||||
|
|
||||||
std::string cmLocalNinjaGenerator::ConvertToLinkReference(
|
std::string cmLocalNinjaGenerator::ConvertToLinkReference(
|
||||||
std::string const& lib, cmOutputConverter::OutputFormat format)
|
std::string const& lib)
|
||||||
{
|
{
|
||||||
std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
|
return this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib);
|
||||||
return this->ConvertToOutputFormat(path, format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
|
std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
|
||||||
|
|||||||
@@ -76,9 +76,7 @@ public:
|
|||||||
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
|
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
|
||||||
cmNinjaDeps& ninjaDeps);
|
cmNinjaDeps& ninjaDeps);
|
||||||
|
|
||||||
std::string ConvertToLinkReference(std::string const& lib,
|
std::string ConvertToLinkReference(std::string const& lib) CM_OVERRIDE;
|
||||||
cmOutputConverter::OutputFormat format =
|
|
||||||
cmOutputConverter::SHELL) CM_OVERRIDE;
|
|
||||||
|
|
||||||
void ComputeObjectFilenames(
|
void ComputeObjectFilenames(
|
||||||
std::map<cmSourceFile const*, std::string>& mapping,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
|||||||
Reference in New Issue
Block a user