summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmComputeLinkInformation.cxx25
-rw-r--r--Source/cmComputeLinkInformation.h13
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmLinkLineComputer.cxx2
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx7
7 files changed, 35 insertions, 24 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 5473316..6371286 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -659,14 +659,14 @@ void cmComputeLinkInformation::AddItem(BT<std::string> const& item,
std::string exe = tgt->GetFullPath(config, artifact, true);
linkItem += exe;
- this->Items.emplace_back(BT<std::string>(linkItem, item.Backtrace), true,
- tgt);
+ this->Items.emplace_back(BT<std::string>(linkItem, item.Backtrace),
+ ItemIsPath::Yes, tgt);
this->Depends.push_back(std::move(exe));
} else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
- this->Items.emplace_back(std::string(), false, tgt);
+ this->Items.emplace_back(std::string(), ItemIsPath::No, tgt);
// Also add the item the interface specifies to be used in its place.
std::string const& libName = tgt->GetImportedLibName(config);
@@ -1038,10 +1038,10 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
if (this->LinkTypeEnabled) {
switch (this->CurrentLinkType) {
case LinkStatic:
- this->Items.emplace_back(this->StaticLinkTypeFlag, false);
+ this->Items.emplace_back(this->StaticLinkTypeFlag, ItemIsPath::No);
break;
case LinkShared:
- this->Items.emplace_back(this->SharedLinkTypeFlag, false);
+ this->Items.emplace_back(this->SharedLinkTypeFlag, ItemIsPath::No);
break;
default:
break;
@@ -1084,7 +1084,7 @@ void cmComputeLinkInformation::AddTargetItem(BT<std::string> const& item,
}
// Now add the full path to the library.
- this->Items.emplace_back(item, true, target);
+ this->Items.emplace_back(item, ItemIsPath::Yes, target);
}
void cmComputeLinkInformation::AddFullItem(BT<std::string> const& item)
@@ -1138,7 +1138,7 @@ void cmComputeLinkInformation::AddFullItem(BT<std::string> const& item)
}
// Now add the full path to the library.
- this->Items.emplace_back(item, true);
+ this->Items.emplace_back(item, ItemIsPath::Yes);
}
bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
@@ -1226,7 +1226,7 @@ void cmComputeLinkInformation::AddUserItem(BT<std::string> const& item,
this->SetCurrentLinkType(this->StartLinkType);
// Use the item verbatim.
- this->Items.emplace_back(item, false);
+ this->Items.emplace_back(item, ItemIsPath::No);
return;
}
@@ -1296,7 +1296,8 @@ void cmComputeLinkInformation::AddUserItem(BT<std::string> const& item,
// Create an option to ask the linker to search for the library.
std::string out = cmStrCat(this->LibLinkFlag, lib, this->LibLinkSuffix);
- this->Items.emplace_back(BT<std::string>(out, item.Backtrace), false);
+ this->Items.emplace_back(BT<std::string>(out, item.Backtrace),
+ ItemIsPath::No);
// Here we could try to find the library the linker will find and
// add a runtime information entry for it. It would probably not be
@@ -1328,13 +1329,13 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
if (this->GlobalGenerator->IsXcode()) {
// Add framework path - it will be handled by Xcode after it's added to
// "Link Binary With Libraries" build phase
- this->Items.emplace_back(item, true);
+ this->Items.emplace_back(item, ItemIsPath::Yes);
} else {
// Add the item using the -framework option.
- this->Items.emplace_back(std::string("-framework"), false);
+ this->Items.emplace_back(std::string("-framework"), ItemIsPath::No);
cmOutputConverter converter(this->Makefile->GetStateSnapshot());
fw = converter.EscapeForShell(fw);
- this->Items.emplace_back(fw, false);
+ this->Items.emplace_back(fw, ItemIsPath::No);
}
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 4acb99f..9afa0eb 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -35,17 +35,24 @@ public:
~cmComputeLinkInformation();
bool Compute();
+ enum class ItemIsPath
+ {
+ No,
+ Yes,
+ };
+
struct Item
{
Item() = default;
- Item(BT<std::string> v, bool p, cmGeneratorTarget const* target = nullptr)
+ Item(BT<std::string> v, ItemIsPath isPath,
+ cmGeneratorTarget const* target = nullptr)
: Value(std::move(v))
- , IsPath(p)
+ , IsPath(isPath)
, Target(target)
{
}
BT<std::string> Value;
- bool IsPath = true;
+ ItemIsPath IsPath = ItemIsPath::Yes;
cmGeneratorTarget const* Target = nullptr;
};
using ItemVector = std::vector<Item>;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 009d133..693a11c 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3454,7 +3454,9 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
libItem.Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY)) ||
- (!libItem.Target && libItem.IsPath && forceLinkPhase))) {
+ (!libItem.Target &&
+ libItem.IsPath == cmComputeLinkInformation::ItemIsPath::Yes &&
+ forceLinkPhase))) {
std::string libName;
bool canUseLinkPhase = true;
if (libItem.Target) {
@@ -3565,7 +3567,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
auto* libTarget = FindXCodeTarget(libItem->Target);
cmXCodeObject* buildFile;
if (!libTarget) {
- if (libItem->IsPath) {
+ if (libItem->IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
// Get or create a direct file ref in the root project
auto cleanPath = libItem->Value.Value;
if (cmSystemTools::FileIsFullPath(cleanPath)) {
@@ -3724,7 +3726,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
BuildObjectListOrString libPaths(this, true);
for (auto const& libItem : configItemMap[configName]) {
auto const& libName = *libItem;
- if (libName.IsPath) {
+ if (libName.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
auto cleanPath = libName.Value.Value;
if (cmSystemTools::FileIsFullPath(cleanPath)) {
cleanPath = cmSystemTools::CollapseFullPath(cleanPath);
diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx
index a3f2968..6eb8d75 100644
--- a/Source/cmLinkLineComputer.cxx
+++ b/Source/cmLinkLineComputer.cxx
@@ -74,7 +74,7 @@ void cmLinkLineComputer::ComputeLinkLibs(
}
BT<std::string> linkLib;
- if (item.IsPath) {
+ if (item.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
linkLib.Value += cli.GetLibLinkFileFlag();
linkLib.Value += this->ConvertToOutputFormat(
this->ConvertToLinkReference(item.Value.Value));
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 9cae926..2ffff96 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -111,7 +111,7 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
}
BT<std::string> linkLib;
- if (item.IsPath) {
+ if (item.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
// nvcc understands absolute paths to libraries ending in '.a' or '.lib'.
// These should be passed to nvlink. Other extensions need to be left
// out because nvlink may not understand or need them. Even though it
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index c50cc5d..151470b 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1254,7 +1254,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
{
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
for (auto const& lib : libs) {
- if (lib.IsPath) {
+ if (lib.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
std::string rel = lg->MaybeRelativeToCurBinDir(lib.Value.Value);
fout << lg->ConvertToXMLOutputPath(rel) << " ";
} else if (!lib.Target ||
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1c8b672..98d56df 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3391,7 +3391,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
}
}
- if (l.IsPath) {
+ if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
std::string path =
this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);
@@ -3945,7 +3945,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
using ItemVector = cmComputeLinkInformation::ItemVector;
const ItemVector& libs = cli.GetItems();
for (cmComputeLinkInformation::Item const& l : libs) {
- if (l.IsPath && cmVS10IsTargetsFile(l.Value.Value)) {
+ if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes &&
+ cmVS10IsTargetsFile(l.Value.Value)) {
std::string path =
this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);
@@ -4028,7 +4029,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
}
}
- if (l.IsPath) {
+ if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) {
std::string path =
this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value);
ConvertToWindowsSlash(path);