summaryrefslogtreecommitdiff
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2019-09-18 17:40:31 +0200
committerRegina Pfeifer <regina@mailbox.org>2019-09-21 05:15:26 +0200
commit1dd31297cad93b5b9a8fd1ab2b5bb9916ffe5d18 (patch)
treefc2c45cfc659cbbb91347798df2116a1fc0fa5a3 /Source/cmTargetLinkLibrariesCommand.cxx
parentd5c63f073f290d4778426825e586240dca7ca0a6 (diff)
downloadcmake-1dd31297cad93b5b9a8fd1ab2b5bb9916ffe5d18.tar.gz
cmTargetLinkLibrariesCommand: Port away from cmCommand
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx261
1 files changed, 138 insertions, 123 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index b4325994fe..0d2383a1cd 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -5,6 +5,7 @@
#include <cstring>
#include <sstream>
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
@@ -15,44 +16,64 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTargetLinkLibraryType.h"
#include "cmake.h"
-class cmExecutionStatus;
+namespace {
-const char* cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[3] = {
- "general", "debug", "optimized"
+enum ProcessingState
+{
+ ProcessingLinkLibraries,
+ ProcessingPlainLinkInterface,
+ ProcessingKeywordLinkInterface,
+ ProcessingPlainPublicInterface,
+ ProcessingKeywordPublicInterface,
+ ProcessingPlainPrivateInterface,
+ ProcessingKeywordPrivateInterface
};
-// cmTargetLinkLibrariesCommand
-bool cmTargetLinkLibrariesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+const char* LinkLibraryTypeNames[3] = { "general", "debug", "optimized" };
+
+} // namespace
+
+static void LinkLibraryTypeSpecifierWarning(cmMakefile& mf, int left,
+ int right);
+
+static bool HandleLibrary(cmMakefile& mf, cmTarget* target,
+ ProcessingState currentProcessingState,
+ const std::string& lib, cmTargetLinkLibraryType llt);
+
+bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
// Must have at least one argument.
if (args.empty()) {
- this->SetError("called with incorrect number of arguments");
+ status.SetError("called with incorrect number of arguments");
return false;
}
+
+ cmMakefile& mf = status.GetMakefile();
+
// Alias targets cannot be on the LHS of this command.
- if (this->Makefile->IsAlias(args[0])) {
- this->SetError("can not be used on an ALIAS target.");
+ if (mf.IsAlias(args[0])) {
+ status.SetError("can not be used on an ALIAS target.");
return false;
}
// Lookup the target for which libraries are specified.
- this->Target =
- this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(
- args[0]);
- if (!this->Target) {
+ cmTarget* target =
+ mf.GetCMakeInstance()->GetGlobalGenerator()->FindTarget(args[0]);
+ if (!target) {
const std::vector<cmTarget*>& importedTargets =
- this->Makefile->GetOwnedImportedTargets();
+ mf.GetOwnedImportedTargets();
for (cmTarget* importedTarget : importedTargets) {
if (importedTarget->GetName() == args[0]) {
- this->Target = importedTarget;
+ target = importedTarget;
break;
}
}
}
- if (!this->Target) {
+ if (!target) {
MessageType t = MessageType::FATAL_ERROR; // fail by default
std::ostringstream e;
e << "Cannot specify link libraries for target \"" << args[0] << "\" "
@@ -60,7 +81,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// The bad target is the only argument. Check how policy CMP0016 is set,
// and accept, warn or fail respectively:
if (args.size() < 2) {
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0016)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0016)) {
case cmPolicies::WARN:
t = MessageType::AUTHOR_WARNING;
// Print the warning.
@@ -84,10 +105,10 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// Now actually print the message.
switch (t) {
case MessageType::AUTHOR_WARNING:
- this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
break;
case MessageType::FATAL_ERROR:
- this->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf.IssueMessage(MessageType::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
break;
default:
@@ -97,11 +118,11 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
}
// Having a UTILITY library on the LHS is a bug.
- if (this->Target->GetType() == cmStateEnums::UTILITY) {
+ if (target->GetType() == cmStateEnums::UTILITY) {
std::ostringstream e;
const char* modal = nullptr;
MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0039)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n";
modal = "should";
@@ -114,9 +135,9 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
messageType = MessageType::FATAL_ERROR;
}
if (modal) {
- e << "Utility target \"" << this->Target->GetName() << "\" " << modal
+ e << "Utility target \"" << target->GetName() << "\" " << modal
<< " not be used as the target of a target_link_libraries call.";
- this->Makefile->IssueMessage(messageType, e.str());
+ mf.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
@@ -134,15 +155,15 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// Start with primary linking and switch to link interface
// specification if the keyword is encountered as the first argument.
- this->CurrentProcessingState = ProcessingLinkLibraries;
+ ProcessingState currentProcessingState = ProcessingLinkLibraries;
// Add libraries, note that there is an optional prefix
// of debug and optimized that can be used.
for (unsigned int i = 1; i < args.size(); ++i) {
if (args[i] == "LINK_INTERFACE_LIBRARIES") {
- this->CurrentProcessingState = ProcessingPlainLinkInterface;
+ currentProcessingState = ProcessingPlainLinkInterface;
if (i != 1) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The LINK_INTERFACE_LIBRARIES option must appear as the second "
"argument, just after the target name.");
@@ -150,84 +171,83 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
}
} else if (args[i] == "INTERFACE") {
if (i != 1 &&
- this->CurrentProcessingState != ProcessingKeywordPrivateInterface &&
- this->CurrentProcessingState != ProcessingKeywordPublicInterface &&
- this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
- this->Makefile->IssueMessage(
+ currentProcessingState != ProcessingKeywordPrivateInterface &&
+ currentProcessingState != ProcessingKeywordPublicInterface &&
+ currentProcessingState != ProcessingKeywordLinkInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
- this->CurrentProcessingState = ProcessingKeywordLinkInterface;
+ currentProcessingState = ProcessingKeywordLinkInterface;
} else if (args[i] == "LINK_PUBLIC") {
if (i != 1 &&
- this->CurrentProcessingState != ProcessingPlainPrivateInterface &&
- this->CurrentProcessingState != ProcessingPlainPublicInterface) {
- this->Makefile->IssueMessage(
+ currentProcessingState != ProcessingPlainPrivateInterface &&
+ currentProcessingState != ProcessingPlainPublicInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
- this->CurrentProcessingState = ProcessingPlainPublicInterface;
+ currentProcessingState = ProcessingPlainPublicInterface;
} else if (args[i] == "PUBLIC") {
if (i != 1 &&
- this->CurrentProcessingState != ProcessingKeywordPrivateInterface &&
- this->CurrentProcessingState != ProcessingKeywordPublicInterface &&
- this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
- this->Makefile->IssueMessage(
+ currentProcessingState != ProcessingKeywordPrivateInterface &&
+ currentProcessingState != ProcessingKeywordPublicInterface &&
+ currentProcessingState != ProcessingKeywordLinkInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
- this->CurrentProcessingState = ProcessingKeywordPublicInterface;
+ currentProcessingState = ProcessingKeywordPublicInterface;
} else if (args[i] == "LINK_PRIVATE") {
- if (i != 1 &&
- this->CurrentProcessingState != ProcessingPlainPublicInterface &&
- this->CurrentProcessingState != ProcessingPlainPrivateInterface) {
- this->Makefile->IssueMessage(
+ if (i != 1 && currentProcessingState != ProcessingPlainPublicInterface &&
+ currentProcessingState != ProcessingPlainPrivateInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The LINK_PUBLIC or LINK_PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
- this->CurrentProcessingState = ProcessingPlainPrivateInterface;
+ currentProcessingState = ProcessingPlainPrivateInterface;
} else if (args[i] == "PRIVATE") {
if (i != 1 &&
- this->CurrentProcessingState != ProcessingKeywordPrivateInterface &&
- this->CurrentProcessingState != ProcessingKeywordPublicInterface &&
- this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
- this->Makefile->IssueMessage(
+ currentProcessingState != ProcessingKeywordPrivateInterface &&
+ currentProcessingState != ProcessingKeywordPublicInterface &&
+ currentProcessingState != ProcessingKeywordLinkInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
- this->CurrentProcessingState = ProcessingKeywordPrivateInterface;
+ currentProcessingState = ProcessingKeywordPrivateInterface;
} else if (args[i] == "debug") {
if (haveLLT) {
- this->LinkLibraryTypeSpecifierWarning(llt, DEBUG_LibraryType);
+ LinkLibraryTypeSpecifierWarning(mf, llt, DEBUG_LibraryType);
}
llt = DEBUG_LibraryType;
haveLLT = true;
} else if (args[i] == "optimized") {
if (haveLLT) {
- this->LinkLibraryTypeSpecifierWarning(llt, OPTIMIZED_LibraryType);
+ LinkLibraryTypeSpecifierWarning(mf, llt, OPTIMIZED_LibraryType);
}
llt = OPTIMIZED_LibraryType;
haveLLT = true;
} else if (args[i] == "general") {
if (haveLLT) {
- this->LinkLibraryTypeSpecifierWarning(llt, GENERAL_LibraryType);
+ LinkLibraryTypeSpecifierWarning(mf, llt, GENERAL_LibraryType);
}
llt = GENERAL_LibraryType;
haveLLT = true;
} else if (haveLLT) {
// The link type was specified by the previous argument.
haveLLT = false;
- if (!this->HandleLibrary(args[i], llt)) {
+ if (!HandleLibrary(mf, target, currentProcessingState, args[i], llt)) {
return false;
}
} else {
@@ -239,7 +259,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// with old versions of CMake and new)
llt = GENERAL_LibraryType;
std::string linkType = cmStrCat(args[0], "_LINK_TYPE");
- const char* linkTypeString = this->Makefile->GetDefinition(linkType);
+ const char* linkTypeString = mf.GetDefinition(linkType);
if (linkTypeString) {
if (strcmp(linkTypeString, "debug") == 0) {
llt = DEBUG_LibraryType;
@@ -248,7 +268,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
llt = OPTIMIZED_LibraryType;
}
}
- if (!this->HandleLibrary(args[i], llt)) {
+ if (!HandleLibrary(mf, target, currentProcessingState, args[i], llt)) {
return false;
}
}
@@ -256,16 +276,14 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// Make sure the last argument was not a library type specifier.
if (haveLLT) {
- this->Makefile->IssueMessage(
- MessageType::FATAL_ERROR,
- cmStrCat("The \"",
- cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[llt],
- "\" argument must be followed by a library."));
+ mf.IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("The \"", LinkLibraryTypeNames[llt],
+ "\" argument must be followed by a library."));
cmSystemTools::SetFatalErrorOccured();
}
const cmPolicies::PolicyStatus policy22Status =
- this->Target->GetPolicyStatusCMP0022();
+ target->GetPolicyStatusCMP0022();
// If any of the LINK_ options were given, make sure the
// LINK_INTERFACE_LIBRARIES target property exists.
@@ -274,41 +292,40 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
// result in an empty link interface.
if ((policy22Status == cmPolicies::OLD ||
policy22Status == cmPolicies::WARN) &&
- this->CurrentProcessingState != ProcessingLinkLibraries &&
- !this->Target->GetProperty("LINK_INTERFACE_LIBRARIES")) {
- this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
+ currentProcessingState != ProcessingLinkLibraries &&
+ !target->GetProperty("LINK_INTERFACE_LIBRARIES")) {
+ target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
}
return true;
}
-void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left,
- int right)
+static void LinkLibraryTypeSpecifierWarning(cmMakefile& mf, int left,
+ int right)
{
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat(
- "Link library type specifier \"",
- cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[left],
- "\" is followed by specifier \"",
- cmTargetLinkLibrariesCommand::LinkLibraryTypeNames[right],
+ "Link library type specifier \"", LinkLibraryTypeNames[left],
+ "\" is followed by specifier \"", LinkLibraryTypeNames[right],
"\" instead of a library name. The first specifier will be ignored."));
}
-bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
- cmTargetLinkLibraryType llt)
+static bool HandleLibrary(cmMakefile& mf, cmTarget* target,
+ ProcessingState currentProcessingState,
+ const std::string& lib, cmTargetLinkLibraryType llt)
{
- if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
- this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
- this->Makefile->IssueMessage(
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
+ currentProcessingState != ProcessingKeywordLinkInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"INTERFACE library can only be used with the INTERFACE keyword of "
"target_link_libraries");
return false;
}
- if (this->Target->IsImported() &&
- this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
- this->Makefile->IssueMessage(
+ if (target->IsImported() &&
+ currentProcessingState != ProcessingKeywordLinkInterface) {
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
"IMPORTED library can only be used with the INTERFACE keyword of "
"target_link_libraries");
@@ -316,19 +333,18 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
}
cmTarget::TLLSignature sig =
- (this->CurrentProcessingState == ProcessingPlainPrivateInterface ||
- this->CurrentProcessingState == ProcessingPlainPublicInterface ||
- this->CurrentProcessingState == ProcessingKeywordPrivateInterface ||
- this->CurrentProcessingState == ProcessingKeywordPublicInterface ||
- this->CurrentProcessingState == ProcessingKeywordLinkInterface)
+ (currentProcessingState == ProcessingPlainPrivateInterface ||
+ currentProcessingState == ProcessingPlainPublicInterface ||
+ currentProcessingState == ProcessingKeywordPrivateInterface ||
+ currentProcessingState == ProcessingKeywordPublicInterface ||
+ currentProcessingState == ProcessingKeywordLinkInterface)
? cmTarget::KeywordTLLSignature
: cmTarget::PlainTLLSignature;
- if (!this->Target->PushTLLCommandTrace(
- sig, this->Makefile->GetExecutionContext())) {
+ if (!target->PushTLLCommandTrace(sig, mf.GetExecutionContext())) {
std::ostringstream e;
const char* modal = nullptr;
MessageType messageType = MessageType::AUTHOR_WARNING;
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0023)) {
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n";
modal = "should";
@@ -349,14 +365,14 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
e << "The " << existingSig
<< " signature for target_link_libraries has "
"already been used with the target \""
- << this->Target->GetName()
+ << target->GetName()
<< "\". All uses of target_link_libraries with a target " << modal
<< " be either all-keyword or all-plain.\n";
- this->Target->GetTllSignatureTraces(e,
- sig == cmTarget::KeywordTLLSignature
- ? cmTarget::PlainTLLSignature
- : cmTarget::KeywordTLLSignature);
- this->Makefile->IssueMessage(messageType, e.str());
+ target->GetTllSignatureTraces(e,
+ sig == cmTarget::KeywordTLLSignature
+ ? cmTarget::PlainTLLSignature
+ : cmTarget::KeywordTLLSignature);
+ mf.IssueMessage(messageType, e.str());
if (messageType == MessageType::FATAL_ERROR) {
return false;
}
@@ -366,9 +382,9 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
bool warnRemoteInterface = false;
bool rejectRemoteLinking = false;
bool encodeRemoteReference = false;
- if (this->Makefile != this->Target->GetMakefile()) {
+ if (&mf != target->GetMakefile()) {
// The LHS target was created in another directory.
- switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0079)) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0079)) {
case cmPolicies::WARN:
warnRemoteInterface = true;
CM_FALLTHROUGH;
@@ -389,7 +405,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// same directory as the target was created. Add a suffix to
// the name to tell ResolveLinkItem to look up the name in the
// caller's directory.
- cmDirectoryId const dirId = this->Makefile->GetDirectoryId();
+ cmDirectoryId const dirId = mf.GetDirectoryId();
libRef = lib + CMAKE_DIRECTORY_ID_SEP + dirId.String;
} else {
// This is an absolute path or a library name added by a caller
@@ -401,21 +417,21 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// Handle normal case where the command was called with another keyword than
// INTERFACE / LINK_INTERFACE_LIBRARIES or none at all. (The "LINK_LIBRARIES"
// property of the target on the LHS shall be populated.)
- if (this->CurrentProcessingState != ProcessingKeywordLinkInterface &&
- this->CurrentProcessingState != ProcessingPlainLinkInterface) {
+ if (currentProcessingState != ProcessingKeywordLinkInterface &&
+ currentProcessingState != ProcessingPlainLinkInterface) {
if (rejectRemoteLinking) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("Attempt to add link library \"", lib, "\" to target \"",
- this->Target->GetName(),
+ target->GetName(),
"\" which is not built in this "
"directory.\nThis is allowed only when policy CMP0079 "
"is set to NEW."));
return false;
}
- cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib);
+ cmTarget* tgt = mf.GetGlobalGenerator()->FindTarget(lib);
if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
(tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
@@ -423,7 +439,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
(tgt->GetType() != cmStateEnums::OBJECT_LIBRARY) &&
(tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
!tgt->IsExecutableWithExports()) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat(
"Target \"", lib, "\" of type ",
@@ -433,15 +449,15 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
"executables with the ENABLE_EXPORTS property set."));
}
- this->Target->AddLinkLibrary(*this->Makefile, lib, libRef, llt);
+ target->AddLinkLibrary(mf, lib, libRef, llt);
}
if (warnRemoteInterface) {
- this->Makefile->IssueMessage(
+ mf.IssueMessage(
MessageType::AUTHOR_WARNING,
cmStrCat(
cmPolicies::GetPolicyWarning(cmPolicies::CMP0079), "\nTarget\n ",
- this->Target->GetName(),
+ target->GetName(),
"\nis not created in this "
"directory. For compatibility with older versions of CMake, link "
"library\n ",
@@ -454,18 +470,17 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// LINK_PRIVATE and stop its processing. (The "INTERFACE_LINK_LIBRARIES"
// property of the target on the LHS shall only be populated if it is a
// STATIC library.)
- if (this->CurrentProcessingState == ProcessingKeywordPrivateInterface ||
- this->CurrentProcessingState == ProcessingPlainPrivateInterface) {
- if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
- this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
+ if (currentProcessingState == ProcessingKeywordPrivateInterface ||
+ currentProcessingState == ProcessingPlainPrivateInterface) {
+ if (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::string configLib =
- this->Target->GetDebugGeneratorExpressions(libRef, llt);
+ target->GetDebugGeneratorExpressions(libRef, llt);
if (cmGeneratorExpression::IsValidTargetName(lib) ||
cmGeneratorExpression::Find(lib) != std::string::npos) {
configLib = "$<LINK_ONLY:" + configLib + ">";
}
- this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
- configLib.c_str());
+ target->AppendProperty("INTERFACE_LINK_LIBRARIES", configLib.c_str());
}
return true;
}
@@ -473,23 +488,23 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// Handle general case where the command was called with another keyword than
// PRIVATE / LINK_PRIVATE or none at all. (The "INTERFACE_LINK_LIBRARIES"
// property of the target on the LHS shall be populated.)
- this->Target->AppendProperty(
+ target->AppendProperty(
"INTERFACE_LINK_LIBRARIES",
- this->Target->GetDebugGeneratorExpressions(libRef, llt).c_str());
+ target->GetDebugGeneratorExpressions(libRef, llt).c_str());
// Stop processing if called without any keyword.
- if (this->CurrentProcessingState == ProcessingLinkLibraries) {
+ if (currentProcessingState == ProcessingLinkLibraries) {
return true;
}
// Stop processing if policy CMP0022 is set to NEW.
const cmPolicies::PolicyStatus policy22Status =
- this->Target->GetPolicyStatusCMP0022();
+ target->GetPolicyStatusCMP0022();
if (policy22Status != cmPolicies::OLD &&
policy22Status != cmPolicies::WARN) {
return true;
}
// Stop processing if called with an INTERFACE library on the LHS.
- if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+ if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return true;
}
@@ -499,7 +514,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
{
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> debugConfigs =
- this->Makefile->GetCMakeInstance()->GetDebugConfigs();
+ mf.GetCMakeInstance()->GetDebugConfigs();
std::string prop;
// Include this library in the link interface for the target.
@@ -507,19 +522,19 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// Put in the DEBUG configuration interfaces.
for (std::string const& dc : debugConfigs) {
prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
- this->Target->AppendProperty(prop, libRef.c_str());
+ target->AppendProperty(prop, libRef.c_str());
}
}
if (llt == OPTIMIZED_LibraryType || llt == GENERAL_LibraryType) {
// Put in the non-DEBUG configuration interfaces.
- this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", libRef.c_str());
+ target->AppendProperty("LINK_INTERFACE_LIBRARIES", libRef.c_str());
// Make sure the DEBUG configuration interfaces exist so that the
// general one will not be used as a fall-back.
for (std::string const& dc : debugConfigs) {
prop = cmStrCat("LINK_INTERFACE_LIBRARIES_", dc);
- if (!this->Target->GetProperty(prop)) {
- this->Target->SetProperty(prop, "");
+ if (!target->GetProperty(prop)) {
+ target->SetProperty(prop, "");
}
}
}