summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-04-19 17:10:09 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-20 14:22:33 (GMT)
commitcf320f7cd74eeb87437f737e6e977f2231e109a1 (patch)
treeb5311bf666cbf9324bbacc446b787658566b5e24 /Source/cmComputeLinkInformation.cxx
parent44f0d2d9913595e214048b6d5a2b9ab2e9d1cf46 (diff)
downloadCMake-cf320f7cd74eeb87437f737e6e977f2231e109a1.zip
CMake-cf320f7cd74eeb87437f737e6e977f2231e109a1.tar.gz
CMake-cf320f7cd74eeb87437f737e6e977f2231e109a1.tar.bz2
Replace boolean `implib` parameters with enum
Named enumeration values are much clearer at call sites and add more type safety.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx20
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 80e7e7d..b273443 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -500,7 +500,10 @@ bool cmComputeLinkInformation::Compute()
cmGeneratorTarget const* tgt = *i;
bool implib = (this->UseImportLibrary &&
(tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
- std::string lib = tgt->GetFullPath(this->Config, implib, true);
+ cmStateEnums::ArtifactType artifact = implib
+ ? cmStateEnums::ImportLibraryArtifact
+ : cmStateEnums::RuntimeBinaryArtifact;
+ std::string lib = tgt->GetFullPath(this->Config, artifact, true);
this->OldLinkDirItems.push_back(lib);
}
}
@@ -596,8 +599,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// platform. Add it now.
std::string linkItem;
linkItem = this->LoaderFlag;
+ cmStateEnums::ArtifactType artifact = this->UseImportLibrary
+ ? cmStateEnums::ImportLibraryArtifact
+ : cmStateEnums::RuntimeBinaryArtifact;
- std::string exe = tgt->GetFullPath(config, this->UseImportLibrary, true);
+ std::string exe = tgt->GetFullPath(config, artifact, true);
linkItem += exe;
this->Items.push_back(Item(linkItem, true, tgt));
this->Depends.push_back(exe);
@@ -617,9 +623,12 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
bool implib =
(this->UseImportLibrary &&
(impexe || tgt->GetType() == cmStateEnums::SHARED_LIBRARY));
+ cmStateEnums::ArtifactType artifact = implib
+ ? cmStateEnums::ImportLibraryArtifact
+ : cmStateEnums::RuntimeBinaryArtifact;
// Pass the full path to the target file.
- std::string lib = tgt->GetFullPath(config, implib, true);
+ std::string lib = tgt->GetFullPath(config, artifact, true);
if (!this->LinkDependsNoShared ||
tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
this->Depends.push_back(lib);
@@ -689,7 +698,10 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
// linked will be able to find it.
std::string lib;
if (tgt) {
- lib = tgt->GetFullPath(this->Config, this->UseImportLibrary);
+ cmStateEnums::ArtifactType artifact = this->UseImportLibrary
+ ? cmStateEnums::ImportLibraryArtifact
+ : cmStateEnums::RuntimeBinaryArtifact;
+ lib = tgt->GetFullPath(this->Config, artifact);
this->AddLibraryRuntimeInfo(lib, tgt);
} else {
lib = item;