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

Method GetFileSuffixInternal

Source/cmGeneratorTarget.cxx:483–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483cmValue cmGeneratorTarget::GetFileSuffixInternal(
484 std::string const& config, cmStateEnums::ArtifactType artifact,
485 std::string const& language) const
486{
487 // no suffix for non-main target types.
488 if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
489 this->GetType() != cmStateEnums::SHARED_LIBRARY &&
490 this->GetType() != cmStateEnums::MODULE_LIBRARY &&
491 this->GetType() != cmStateEnums::EXECUTABLE) {
492 return nullptr;
493 }
494
495 bool const isImportedLibraryArtifact =
496 (artifact == cmStateEnums::ImportLibraryArtifact);
497
498 // Return an empty suffix for the import library if this platform
499 // does not support import libraries.
500 if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) {
501 return nullptr;
502 }
503
504 // The implib option is only allowed for shared libraries, module
505 // libraries, and executables.
506 if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
507 this->GetType() != cmStateEnums::MODULE_LIBRARY &&
508 this->GetType() != cmStateEnums::EXECUTABLE) {
509 artifact = cmStateEnums::RuntimeBinaryArtifact;
510 }
511
512 // Compute suffix value.
513 cmValue targetSuffix =
514 (isImportedLibraryArtifact ? this->GetProperty("IMPORT_SUFFIX")
515 : this->GetProperty("SUFFIX"));
516
517 if (!targetSuffix) {
518 char const* suffixVar = this->Target->GetSuffixVariableInternal(artifact);
519 if (!language.empty() && cmNonempty(suffixVar)) {
520 std::string langSuffix = cmStrCat(suffixVar, '_', language);
521 targetSuffix = this->Makefile->GetDefinition(langSuffix);
522 }
523
524 // if there is no suffix on the target nor specific language
525 // use the cmake definition.
526 if (!targetSuffix && suffixVar) {
527 targetSuffix = this->Makefile->GetDefinition(suffixVar);
528 }
529 }
530
531 return targetSuffix;
532}
533
534void cmGeneratorTarget::ClearSourcesCache()
535{

Callers 2

GetFileSuffixMethod · 0.95

Calls 8

GetTypeMethod · 0.95
NeedImportLibraryNameMethod · 0.95
GetPropertyMethod · 0.95
cmNonemptyFunction · 0.85
cmStrCatFunction · 0.70
emptyMethod · 0.45
GetDefinitionMethod · 0.45

Tested by

no test coverage detected