diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-08 10:21:38 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-10 18:38:59 (GMT) |
commit | 77c4202edc242c96087295585a85a20700bdb26f (patch) | |
tree | fd0c780e1e758ed43e5b2958cd467cca9ad78c7a /Source/cmLinkLineComputer.cxx | |
parent | 09b6cc66b09b9689ca01faee5e33ef101b46f972 (diff) | |
download | CMake-77c4202edc242c96087295585a85a20700bdb26f.zip CMake-77c4202edc242c96087295585a85a20700bdb26f.tar.gz CMake-77c4202edc242c96087295585a85a20700bdb26f.tar.bz2 |
cmLinkLineComputer: Move RPath computation from cmLocalGenerator
Add state for Relink and populate it at the point of cmLinkLineComputer
initialization. This allows removal of the parameter in go-between
methods.
Diffstat (limited to 'Source/cmLinkLineComputer.cxx')
-rw-r--r-- | Source/cmLinkLineComputer.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index a5e8b72..3675887 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -12,6 +12,7 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter, , OutputConverter(outputConverter) , ForResponse(false) , UseWatcomQuote(false) + , Relink(false) { } @@ -29,6 +30,11 @@ void cmLinkLineComputer::SetForResponse(bool forResponse) this->ForResponse = forResponse; } +void cmLinkLineComputer::SetRelink(bool relink) +{ + this->Relink = relink; +} + std::string cmLinkLineComputer::ConvertToLinkReference( std::string const& lib) const { @@ -100,3 +106,33 @@ std::string cmLinkLineComputer::ComputeLinkPath( } return linkPath; } + +std::string cmLinkLineComputer::ComputeRPath(cmComputeLinkInformation& cli) +{ + std::string rpath; + // Check what kind of rpath flags to use. + if (cli.GetRuntimeSep().empty()) { + // Each rpath entry gets its own option ("-R a -R b -R c") + std::vector<std::string> runtimeDirs; + cli.GetRPath(runtimeDirs, this->Relink); + + for (std::vector<std::string>::iterator ri = runtimeDirs.begin(); + ri != runtimeDirs.end(); ++ri) { + rpath += cli.GetRuntimeFlag(); + rpath += this->ConvertToOutputFormat(*ri); + rpath += " "; + } + } else { + // All rpath entries are combined ("-Wl,-rpath,a:b:c"). + std::string rpathString = cli.GetRPathString(this->Relink); + + // Store the rpath option in the stream. + if (!rpathString.empty()) { + rpath += cli.GetRuntimeFlag(); + rpath += + this->OutputConverter->EscapeForShell(rpathString, !this->ForResponse); + rpath += " "; + } + } + return rpath; +} |