MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleLibrary

Method HandleLibrary

Source/cmTargetLinkLibrariesCommand.cxx:357–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357bool TLL::HandleLibrary(ProcessingState currentProcessingState,
358 std::string const& lib, cmTargetLinkLibraryType llt)
359{
360 if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
361 currentProcessingState != ProcessingKeywordLinkInterface) {
362 this->Makefile.IssueMessage(
363 MessageType::FATAL_ERROR,
364 "INTERFACE library can only be used with the INTERFACE keyword of "
365 "target_link_libraries");
366 return false;
367 }
368 if (this->Target->IsImported() &&
369 currentProcessingState != ProcessingKeywordLinkInterface) {
370 this->Makefile.IssueMessage(
371 MessageType::FATAL_ERROR,
372 "IMPORTED library can only be used with the INTERFACE keyword of "
373 "target_link_libraries");
374 return false;
375 }
376
377 cmTarget::TLLSignature sig =
378 (currentProcessingState == ProcessingPlainPrivateInterface ||
379 currentProcessingState == ProcessingPlainPublicInterface ||
380 currentProcessingState == ProcessingKeywordPrivateInterface ||
381 currentProcessingState == ProcessingKeywordPublicInterface ||
382 currentProcessingState == ProcessingKeywordLinkInterface)
383 ? cmTarget::KeywordTLLSignature
384 : cmTarget::PlainTLLSignature;
385 if (!this->Target->PushTLLCommandTrace(
386 sig, this->Makefile.GetBacktrace().Top())) {
387 std::ostringstream e;
388 // If the sig is a keyword form and there is a conflict, the existing
389 // form must be the plain form.
390 char const* existingSig =
391 (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
392 e << "The " << existingSig
393 << " signature for target_link_libraries has "
394 "already been used with the target \""
395 << this->Target->GetName()
396 << "\". All uses of target_link_libraries with a target must "
397 << " be either all-keyword or all-plain.\n";
398 this->Target->GetTllSignatureTraces(e,
399 sig == cmTarget::KeywordTLLSignature
400 ? cmTarget::PlainTLLSignature
401 : cmTarget::KeywordTLLSignature);
402 this->Makefile.IssueMessage(MessageType::FATAL_ERROR, e.str());
403 return false;
404 }
405
406 // Handle normal case where the command was called with another keyword than
407 // INTERFACE / LINK_INTERFACE_LIBRARIES or none at all. (The "LINK_LIBRARIES"
408 // property of the target on the LHS shall be populated.)
409 if (currentProcessingState != ProcessingKeywordLinkInterface &&
410 currentProcessingState != ProcessingPlainLinkInterface) {
411
412 if (this->RejectRemoteLinking) {
413 this->Makefile.IssueMessage(
414 MessageType::FATAL_ERROR,

Callers 1

Calls 15

AffectsPropertyMethod · 0.95
AppendPropertyMethod · 0.95
PushTLLCommandTraceMethod · 0.80
GetTllSignatureTracesMethod · 0.80
strMethod · 0.80
FindTargetMethod · 0.80
cmStrCatFunction · 0.70
GetTypeMethod · 0.45
IssueMessageMethod · 0.45
IsImportedMethod · 0.45
GetBacktraceMethod · 0.45

Tested by

no test coverage detected