diff options
Diffstat (limited to 'Source/cmLinkLineComputer.cxx')
-rw-r--r-- | Source/cmLinkLineComputer.cxx | 49 |
1 files changed, 48 insertions, 1 deletions
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); +} |