cmLocalGenerator: Add response file option to OutputLinkLibraries

Response files require different path conversion to be threaded
through construction of the link libraries flags.
This commit is contained in:
Brad King 2014-03-04 13:20:04 -05:00
parent b9aa504198
commit 5e8e4d0f88
3 changed files with 17 additions and 11 deletions

View File

@ -1671,7 +1671,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
}
this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
*target, false);
*target, false, false);
}
break;
case cmTarget::EXECUTABLE:
@ -1696,7 +1696,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
}
this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
*target, false);
*target, false, false);
if(cmSystemTools::IsOn
(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
{
@ -1793,8 +1793,11 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
std::string& frameworkPath,
std::string& linkPath,
cmGeneratorTarget &tgt,
bool relink)
bool relink,
bool forResponseFile)
{
OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL;
bool escapeAllowMakeVars = !forResponseFile;
cmOStringStream fout;
const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config);
@ -1837,7 +1840,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
fdi != fwDirs.end(); ++fdi)
{
frameworkPath += fwSearchFlag;
frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
frameworkPath += this->Convert(fdi->c_str(), NONE, shellFormat, false);
frameworkPath += " ";
}
}
@ -1847,7 +1850,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
for(std::vector<std::string>::const_iterator libDir = libDirs.begin();
libDir != libDirs.end(); ++libDir)
{
std::string libpath = this->ConvertToOutputForExisting(libDir->c_str());
std::string libpath = this->ConvertToOutputForExisting(libDir->c_str(),
START_OUTPUT,
shellFormat);
linkPath += " " + libPathFlag;
linkPath += libpath;
linkPath += libPathTerminator;
@ -1865,7 +1870,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
}
if(li->IsPath)
{
linkLibs += this->ConvertToLinkReference(li->Value);
linkLibs += this->ConvertToLinkReference(li->Value, shellFormat);
}
else
{
@ -1890,7 +1895,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
ri != runtimeDirs.end(); ++ri)
{
rpath += cli.GetRuntimeFlag();
rpath += this->Convert(ri->c_str(), NONE, SHELL, false);
rpath += this->Convert(ri->c_str(), NONE, shellFormat, false);
rpath += " ";
}
fout << rpath;
@ -1904,7 +1909,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
if(!rpath.empty())
{
fout << cli.GetRuntimeFlag();
fout << this->EscapeForShell(rpath.c_str(), true);
fout << this->EscapeForShell(rpath.c_str(), escapeAllowMakeVars);
fout << " ";
}
}
@ -1914,7 +1919,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
if(!cli.GetRPathLinkFlag().empty() && !rpath_link.empty())
{
fout << cli.GetRPathLinkFlag();
fout << this->EscapeForShell(rpath_link.c_str(), true);
fout << this->EscapeForShell(rpath_link.c_str(), escapeAllowMakeVars);
fout << " ";
}

View File

@ -372,7 +372,8 @@ protected:
std::string& frameworkPath,
std::string& linkPath,
cmGeneratorTarget &,
bool relink);
bool relink,
bool forResponseFile);
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(std::string& string,

View File

@ -1840,7 +1840,7 @@ cmMakefileTargetGenerator
std::string linkPath;
this->LocalGenerator
->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
*this->GeneratorTarget, relink);
*this->GeneratorTarget, relink, false);
linkLibs = frameworkPath + linkPath + linkLibs;
}