summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorPeter Kümmel <syntheticpp@gmx.net>2012-09-26 12:38:15 (GMT)
committerBrad King <brad.king@kitware.com>2012-10-01 21:06:38 (GMT)
commit8d674e78449d4bcde669ee5c4a6c0809c0ee51a5 (patch)
treed4c6ba81d8de360273e5d43f0d2ecc81e50642f7 /Source/cmLocalGenerator.cxx
parentdbd99d6fbbdf76181ac01ec9cc32fd3b67a4ce7c (diff)
downloadCMake-8d674e78449d4bcde669ee5c4a6c0809c0ee51a5.zip
CMake-8d674e78449d4bcde669ee5c4a6c0809c0ee51a5.tar.gz
CMake-8d674e78449d4bcde669ee5c4a6c0809c0ee51a5.tar.bz2
Ninja: move -LIBPATH behind -link option
Don' pass linker option to the compile
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx41
1 files changed, 25 insertions, 16 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d452658..2b36ad0 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -676,9 +676,13 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang,
// Static Library:
// Shared Module:
std::string linkLibs; // should be set
+ std::string frameworkPath;
+ std::string linkPath;
std::string flags; // should be set
std::string linkFlags; // should be set
- this->GetTargetFlags(linkLibs, flags, linkFlags, &target);
+ this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
+ &target);
+ linkLibs = frameworkPath + linkPath + linkLibs;
cmLocalGenerator::RuleVariables vars;
vars.Language = llang;
vars.Objects = objs.c_str();
@@ -1450,6 +1454,8 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
std::string& flags,
std::string& linkFlags,
+ std::string& frameworkPath,
+ std::string& linkPath,
cmGeneratorTarget* target)
{
std::string buildType =
@@ -1531,9 +1537,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += " ";
}
}
- cmOStringStream linklibsStr;
- this->OutputLinkLibraries(linklibsStr, *target, false);
- linkLibs = linklibsStr.str();
+ this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
+ *target, false);
}
break;
case cmTarget::EXECUTABLE:
@@ -1557,9 +1562,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
return;
}
this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
- cmOStringStream linklibs;
- this->OutputLinkLibraries(linklibs, *target, false);
- linkLibs = linklibs.str();
+ this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
+ *target, false);
if(cmSystemTools::IsOn
(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")))
{
@@ -1651,10 +1655,13 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
* targetLibrary should be a NULL pointer. For libraries, it should point
* to the name of the library. This will not link a library against itself.
*/
-void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
- cmGeneratorTarget& tgt,
+void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
+ std::string& frameworkPath,
+ std::string& linkPath,
+ cmGeneratorTarget &tgt,
bool relink)
{
+ cmOStringStream fout;
const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
if(!pcli)
@@ -1688,9 +1695,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
fdi != fwDirs.end(); ++fdi)
{
- linkLibs += "-F";
- linkLibs += this->Convert(fdi->c_str(), NONE, SHELL, false);
- linkLibs += " ";
+ frameworkPath = " -F";
+ frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
+ frameworkPath += " ";
}
// Append the library search path flags.
@@ -1699,10 +1706,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
libDir != libDirs.end(); ++libDir)
{
std::string libpath = this->ConvertToOutputForExisting(libDir->c_str());
- linkLibs += libPathFlag;
- linkLibs += libpath;
- linkLibs += libPathTerminator;
- linkLibs += " ";
+ linkPath += " " + libPathFlag;
+ linkPath += libpath;
+ linkPath += libPathTerminator;
+ linkPath += " ";
}
// Append the link items.
@@ -1774,6 +1781,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
{
fout << stdLibs << " ";
}
+
+ linkLibraries = fout.str();
}