summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.h5
-rw-r--r--Source/cmLinkLineComputer.cxx49
-rw-r--r--Source/cmLinkLineComputer.h17
-rw-r--r--Source/cmLocalGenerator.cxx19
-rw-r--r--Source/cmMSVC60LinkLineComputer.cxx5
-rw-r--r--Source/cmMSVC60LinkLineComputer.h3
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmMakefileTargetGenerator.h3
-rw-r--r--Source/cmNinjaLinkLineComputer.cxx5
-rw-r--r--Source/cmNinjaLinkLineComputer.h3
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx3
-rw-r--r--Source/cmServerProtocol.cxx10
-rw-r--r--Source/cmake.cxx6
19 files changed, 113 insertions, 49 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 959bfc1..04c45e5 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -365,6 +365,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->GetGlobalGenerator()->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
this->LocalGenerator->GetTargetFlags(
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2266e44..1aa6af1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1415,15 +1415,15 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
}
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
- cmState::Directory stateDir) const
+ cmOutputConverter* outputConverter, cmState::Directory stateDir) const
{
- return new cmLinkLineComputer(stateDir);
+ return new cmLinkLineComputer(outputConverter, stateDir);
}
cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
- cmState::Directory stateDir) const
+ cmOutputConverter* outputConverter, cmState::Directory stateDir) const
{
- return new cmMSVC60LinkLineComputer(stateDir);
+ return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
}
void cmGlobalGenerator::FinalizeTargetCompileInfo()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 126eb6f..38eaa76 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -36,6 +36,7 @@ class cmGeneratorTarget;
class cmLocalGenerator;
class cmLinkLineComputer;
class cmMakefile;
+class cmOutputConverter;
class cmake;
/** \class cmGlobalGenerator
@@ -107,10 +108,10 @@ public:
virtual void Generate();
virtual cmLinkLineComputer* CreateLinkLineComputer(
- cmState::Directory stateDir) const;
+ cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
cmLinkLineComputer* CreateMSVC60LinkLineComputer(
- cmState::Directory stateDir) const;
+ cmOutputConverter* outputConverter, cmState::Directory stateDir) const;
/**
* Set/Get and Clear the enabled languages.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 65a1f25..67df038 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -66,9 +66,10 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
}
cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
- cmState::Directory /* stateDir */) const
+ cmOutputConverter* outputConverter, cmState::Directory /* stateDir */) const
{
return new cmNinjaLinkLineComputer(
+ outputConverter,
this->LocalGenerators[0]->GetStateSnapshot().GetDirectory(), this);
}
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 87faf45..6b77a2b 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -70,8 +70,9 @@ public:
std::string EncodePath(const std::string& path);
static std::string EncodeDepfileSpace(const std::string& path);
- cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir) const
- CM_OVERRIDE;
+ cmLinkLineComputer* CreateLinkLineComputer(
+ cmOutputConverter* outputConverter,
+ cmState::Directory stateDir) const CM_OVERRIDE;
/**
* Write the given @a comment to the output stream @a os. It
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index 7103a5b..b2b56bf 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -2,10 +2,16 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkLineComputer.h"
+#include "cmComputeLinkInformation.h"
+#include "cmGeneratorTarget.h"
#include "cmOutputConverter.h"
-cmLinkLineComputer::cmLinkLineComputer(cmState::Directory stateDir)
+cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
+ cmState::Directory stateDir)
: StateDir(stateDir)
+ , OutputConverter(outputConverter)
+ , ForResponse(false)
+ , UseWatcomQuote(false)
{
}
@@ -13,6 +19,16 @@ cmLinkLineComputer::~cmLinkLineComputer()
{
}
+void cmLinkLineComputer::SetUseWatcomQuote(bool useWatcomQuote)
+{
+ this->UseWatcomQuote = useWatcomQuote;
+}
+
+void cmLinkLineComputer::SetForResponse(bool forResponse)
+{
+ this->ForResponse = forResponse;
+}
+
std::string cmLinkLineComputer::ConvertToLinkReference(
std::string const& lib) const
{
@@ -25,3 +41,34 @@ std::string cmLinkLineComputer::ConvertToLinkReference(
}
return relLib;
}
+
+std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli)
+{
+ std::string linkLibs;
+ typedef cmComputeLinkInformation::ItemVector ItemVector;
+ ItemVector const& items = cli.GetItems();
+ for (ItemVector::const_iterator li = items.begin(); li != items.end();
+ ++li) {
+ if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
+ continue;
+ }
+ if (li->IsPath) {
+ linkLibs +=
+ this->ConvertToOutputFormat(this->ConvertToLinkReference(li->Value));
+ } else {
+ linkLibs += li->Value;
+ }
+ linkLibs += " ";
+ }
+ return linkLibs;
+}
+
+std::string cmLinkLineComputer::ConvertToOutputFormat(std::string const& input)
+{
+ cmOutputConverter::OutputFormat shellFormat = (this->ForResponse)
+ ? cmOutputConverter::RESPONSE
+ : ((this->UseWatcomQuote) ? cmOutputConverter::WATCOMQUOTE
+ : cmOutputConverter::SHELL);
+
+ return this->OutputConverter->ConvertToOutputFormat(input, shellFormat);
+}
diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h
index bd4c740..2317385 100644
--- a/Source/cmLinkLineComputer.h
+++ b/Source/cmLinkLineComputer.h
@@ -6,16 +6,31 @@
#include "cmState.h"
+class cmComputeLinkInformation;
+class cmOutputConverter;
+
class cmLinkLineComputer
{
public:
- cmLinkLineComputer(cmState::Directory stateDir);
+ cmLinkLineComputer(cmOutputConverter* outputConverter,
+ cmState::Directory stateDir);
virtual ~cmLinkLineComputer();
+ void SetUseWatcomQuote(bool useWatcomQuote);
+ void SetForResponse(bool forResponse);
+
virtual std::string ConvertToLinkReference(std::string const& input) const;
+ std::string ComputeLinkLibs(cmComputeLinkInformation& cli);
+
private:
+ std::string ConvertToOutputFormat(std::string const& input);
+
cmState::Directory StateDir;
+ cmOutputConverter* OutputConverter;
+
+ bool ForResponse;
+ bool UseWatcomQuote;
};
#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 25755d7..0d2fe86 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1453,24 +1453,7 @@ void cmLocalGenerator::OutputLinkLibraries(
linkPath += " ";
}
- std::string linkLibs;
-
- // Append the link items.
- typedef cmComputeLinkInformation::ItemVector ItemVector;
- ItemVector const& items = cli.GetItems();
- for (ItemVector::const_iterator li = items.begin(); li != items.end();
- ++li) {
- if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) {
- continue;
- }
- if (li->IsPath) {
- linkLibs += this->ConvertToOutputFormat(
- linkLineComputer->ConvertToLinkReference(li->Value), shellFormat);
- } else {
- linkLibs += li->Value;
- }
- linkLibs += " ";
- }
+ std::string linkLibs = linkLineComputer->ComputeLinkLibs(cli);
std::string rpath;
diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx
index 89432ff..2b6df2a 100644
--- a/Source/cmMSVC60LinkLineComputer.cxx
+++ b/Source/cmMSVC60LinkLineComputer.cxx
@@ -5,8 +5,9 @@
#include "cmSystemTools.h"
-cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(cmState::Directory stateDir)
- : cmLinkLineComputer(stateDir)
+cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer(
+ cmOutputConverter* outputConverter, cmState::Directory stateDir)
+ : cmLinkLineComputer(outputConverter, stateDir)
{
}
diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h
index c159b61..ca9da31 100644
--- a/Source/cmMSVC60LinkLineComputer.h
+++ b/Source/cmMSVC60LinkLineComputer.h
@@ -9,7 +9,8 @@
class cmMSVC60LinkLineComputer : public cmLinkLineComputer
{
public:
- cmMSVC60LinkLineComputer(cmState::Directory stateDir);
+ cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter,
+ cmState::Directory stateDir);
std::string ConvertToLinkReference(std::string const& input) const
CM_OVERRIDE;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 09967ff..eaa5061 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -219,6 +219,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
@@ -305,7 +306,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
// Collect up flags to link in needed libraries.
std::string linkLibs;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index e32f3a7..ccc6d9f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -163,6 +163,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
@@ -193,6 +194,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
@@ -505,7 +507,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
+ this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
+ linkLineComputer->SetForResponse(useResponseFileForLibs);
+ linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
this->CreateLinkLibs(linkLineComputer.get(), linkLibs, relink,
useResponseFileForLibs, depends, useWatcomQuote);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index c74b381..d9102a6 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1590,12 +1590,14 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
}
cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer(
- cmState::Directory stateDir)
+ cmOutputConverter* outputConverter, cmState::Directory stateDir)
{
if (this->Makefile->IsOn("MSVC60")) {
- return this->GlobalGenerator->CreateMSVC60LinkLineComputer(stateDir);
+ return this->GlobalGenerator->CreateMSVC60LinkLineComputer(outputConverter,
+ stateDir);
}
- return this->GlobalGenerator->CreateLinkLineComputer(stateDir);
+ return this->GlobalGenerator->CreateLinkLineComputer(outputConverter,
+ stateDir);
}
void cmMakefileTargetGenerator::CreateLinkLibs(
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 05de7ff..0930d89 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -140,7 +140,8 @@ protected:
std::vector<std::string>& makefile_commands,
std::vector<std::string>& makefile_depends);
- cmLinkLineComputer* CreateLinkLineComputer(cmState::Directory stateDir);
+ cmLinkLineComputer* CreateLinkLineComputer(
+ cmOutputConverter* outputConverter, cmState::Directory stateDir);
/** Create a response file with the given set of options. Returns
the relative path from the target build working directory to the
diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx
index dd74238..3dcb20b 100644
--- a/Source/cmNinjaLinkLineComputer.cxx
+++ b/Source/cmNinjaLinkLineComputer.cxx
@@ -5,8 +5,9 @@
#include "cmGlobalNinjaGenerator.h"
cmNinjaLinkLineComputer::cmNinjaLinkLineComputer(
- cmState::Directory stateDir, cmGlobalNinjaGenerator const* gg)
- : cmLinkLineComputer(stateDir)
+ cmOutputConverter* outputConverter, cmState::Directory stateDir,
+ cmGlobalNinjaGenerator const* gg)
+ : cmLinkLineComputer(outputConverter, stateDir)
, GG(gg)
{
}
diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h
index d86f214..a108568 100644
--- a/Source/cmNinjaLinkLineComputer.h
+++ b/Source/cmNinjaLinkLineComputer.h
@@ -12,7 +12,8 @@ class cmGlobalNinjaGenerator;
class cmNinjaLinkLineComputer : public cmLinkLineComputer
{
public:
- cmNinjaLinkLineComputer(cmState::Directory stateDir,
+ cmNinjaLinkLineComputer(cmOutputConverter* outputConverter,
+ cmState::Directory stateDir,
cmGlobalNinjaGenerator const* gg);
std::string ConvertToLinkReference(std::string const& input) const
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 9c22353..a458bbb 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -473,7 +473,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
this->GetGlobalGenerator()->CreateLinkLineComputer(
- localGen.GetStateSnapshot().GetDirectory()));
+ this->GetLocalGenerator(),
+ this->GetLocalGenerator()->GetStateSnapshot().GetDirectory()));
localGen.GetTargetFlags(linkLineComputer.get(), this->GetConfigName(),
vars["LINK_LIBRARIES"], vars["FLAGS"],
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index a58510e..d537cfd 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -729,12 +729,10 @@ static Json::Value DumpTarget(cmGeneratorTarget* target,
std::string linkLanguageFlags;
std::string frameworkPath;
std::string linkPath;
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
- lg->GetGlobalGenerator()->CreateLinkLineComputer(
- lg->GetStateSnapshot().GetDirectory()));
- lg->GetTargetFlags(linkLineComputer.get(), config, linkLibs,
- linkLanguageFlags, linkFlags, frameworkPath, linkPath,
- target, false);
+ cmLinkLineComputer linkLineComputer(lg,
+ lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(&linkLineComputer, config, linkLibs, linkLanguageFlags,
+ linkFlags, frameworkPath, linkPath, target, false);
linkLibs = cmSystemTools::TrimWhitespace(linkLibs);
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 046b5f1..50f77f4 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -583,9 +583,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
gg->CreateGenerationObjects();
cmGeneratorTarget* gtgt = gg->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
- CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer(
- gg->CreateLinkLineComputer(lg->GetStateSnapshot().GetDirectory()));
- lg->GetTargetFlags(linkLineComputer.get(), buildType, linkLibs, flags,
+ cmLinkLineComputer linkLineComputer(lg,
+ lg->GetStateSnapshot().GetDirectory());
+ lg->GetTargetFlags(&linkLineComputer, buildType, linkLibs, flags,
linkFlags, frameworkPath, linkPath, gtgt, false);
linkLibs = frameworkPath + linkPath + linkLibs;