summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-12 19:51:47 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-13 16:47:25 (GMT)
commit15fa3200715869d5acb94a282feb301d2e10a0eb (patch)
tree9c5d6c18b03b2917cc54d7fa2cfa5b9c89d8e4b0 /Source/cmVisualStudio10TargetGenerator.cxx
parent1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (diff)
downloadCMake-15fa3200715869d5acb94a282feb301d2e10a0eb.zip
CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.gz
CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.bz2
cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work directories (e.g. top of the build tree) as the local path. Add helpers for each of the common cases to simplify and clarify call sites.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 12a3679..a7a908e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3356,8 +3356,6 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
// cmLinkLineDeviceComputer
cmComputeLinkInformation& cli = *pcli;
std::vector<std::string> libVec;
- const std::string currentBinDir =
- this->LocalGenerator->GetCurrentBinaryDirectory();
const auto& libs = cli.GetItems();
for (cmComputeLinkInformation::Item const& l : libs) {
@@ -3394,8 +3392,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
}
if (l.IsPath) {
- std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value.Value);
+ std::string path =
+ this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);
if (!cmVS10IsTargetsFile(l.Value.Value)) {
libVec.push_back(path);
@@ -3946,12 +3944,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
cmComputeLinkInformation& cli = *pcli;
using ItemVector = cmComputeLinkInformation::ItemVector;
const ItemVector& libs = cli.GetItems();
- std::string currentBinDir =
- this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmComputeLinkInformation::Item const& l : libs) {
if (l.IsPath && cmVS10IsTargetsFile(l.Value.Value)) {
- std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value.Value);
+ std::string path =
+ this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);
this->AddTargetsFileAndConfigPair(path, config);
}
@@ -3991,8 +3987,6 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
{
using ItemVector = cmComputeLinkInformation::ItemVector;
ItemVector const& libs = cli.GetItems();
- std::string currentBinDir =
- this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmComputeLinkInformation::Item const& l : libs) {
if (l.Target) {
auto managedType = l.Target->GetManagedType(config);
@@ -4035,8 +4029,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
}
if (l.IsPath) {
- std::string path = this->LocalGenerator->MaybeConvertToRelativePath(
- currentBinDir, l.Value.Value);
+ std::string path =
+ this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);
if (cmVS10IsTargetsFile(l.Value.Value)) {
vsTargetVec.push_back(path);