summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-08 10:21:36 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-10 18:38:54 (GMT)
commit7ef834682547df5e0ccdcd503558dcbf1206a638 (patch)
treea90aabc08970996773103105c00a45859e197184
parent69295812065a5d07c07347add2fdcf8f36f993ba (diff)
downloadCMake-7ef834682547df5e0ccdcd503558dcbf1206a638.zip
CMake-7ef834682547df5e0ccdcd503558dcbf1206a638.tar.gz
CMake-7ef834682547df5e0ccdcd503558dcbf1206a638.tar.bz2
cmLocalGenerator: Pass link library info to OutputLinkLibraries
Remove the cmGeneratorTarget from the interface. This is simplification of the OutputLinkLibraries responsibilities so that it can be broken apart into multiple methods.
-rw-r--r--Source/cmLocalGenerator.cxx30
-rw-r--r--Source/cmLocalGenerator.h8
-rw-r--r--Source/cmMakefileTargetGenerator.cxx9
3 files changed, 27 insertions, 20 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c152a8b..ae4a0b2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1155,6 +1155,7 @@ void cmLocalGenerator::GetTargetFlags(
bool useWatcomQuote)
{
const std::string buildType = cmSystemTools::UpperCase(config);
+ cmComputeLinkInformation* pcli = target->GetLinkInformation(config);
const char* libraryLinkVariable =
"CMAKE_SHARED_LINKER_FLAGS"; // default to shared library
@@ -1205,9 +1206,11 @@ void cmLocalGenerator::GetTargetFlags(
linkFlags += " ";
}
}
- this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
- linkPath, *target, false, false,
- useWatcomQuote);
+ if (pcli) {
+ this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath, false, false,
+ useWatcomQuote);
+ }
} break;
case cmState::EXECUTABLE: {
linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
@@ -1226,9 +1229,11 @@ void cmLocalGenerator::GetTargetFlags(
return;
}
this->AddLanguageFlags(flags, linkLanguage, buildType);
- this->OutputLinkLibraries(linkLineComputer, linkLibs, frameworkPath,
- linkPath, *target, false, false,
- useWatcomQuote);
+ if (pcli) {
+ this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath, false, false,
+ useWatcomQuote);
+ }
if (cmSystemTools::IsOn(
this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) {
std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") +
@@ -1393,19 +1398,16 @@ std::string cmLocalGenerator::GetTargetFortranFlags(
* to the name of the library. This will not link a library against itself.
*/
void cmLocalGenerator::OutputLinkLibraries(
- cmLinkLineComputer* linkLineComputer, std::string& linkLibraries,
- std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget& tgt,
- bool relink, bool forResponseFile, bool useWatcomQuote)
+ cmComputeLinkInformation* pcli, cmLinkLineComputer* linkLineComputer,
+ std::string& linkLibraries, std::string& frameworkPath,
+ std::string& linkPath, bool relink, bool forResponseFile,
+ bool useWatcomQuote)
{
OutputFormat shellFormat =
(forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL);
bool escapeAllowMakeVars = !forResponseFile;
std::ostringstream fout;
- std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config);
- if (!pcli) {
- return;
- }
+
cmComputeLinkInformation& cli = *pcli;
std::string linkLanguage = cli.GetLinkLanguage();
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index e19cba2..12b2b69 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -19,6 +19,7 @@
#include <string>
#include <vector>
+class cmComputeLinkInformation;
class cmCustomCommandGenerator;
class cmGeneratorTarget;
class cmGlobalGenerator;
@@ -347,11 +348,12 @@ public:
protected:
///! put all the libraries for a target on into the given stream
- void OutputLinkLibraries(cmLinkLineComputer* linkLineComputer,
+ void OutputLinkLibraries(cmComputeLinkInformation* pcli,
+ cmLinkLineComputer* linkLineComputer,
std::string& linkLibraries,
std::string& frameworkPath, std::string& linkPath,
- cmGeneratorTarget&, bool relink,
- bool forResponseFile, bool useWatcomQuote);
+ bool relink, bool forResponseFile,
+ bool useWatcomQuote);
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(std::string& string,
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d507326..c74b381 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1605,9 +1605,12 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
{
std::string frameworkPath;
std::string linkPath;
- this->LocalGenerator->OutputLinkLibraries(
- linkLineComputer, linkLibs, frameworkPath, linkPath,
- *this->GeneratorTarget, relink, useResponseFile, useWatcomQuote);
+ std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ cmComputeLinkInformation* pcli =
+ this->GeneratorTarget->GetLinkInformation(config);
+ this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
+ frameworkPath, linkPath, relink,
+ useResponseFile, useWatcomQuote);
linkLibs = frameworkPath + linkPath + linkLibs;
if (useResponseFile && linkLibs.find_first_not_of(' ') != linkLibs.npos) {