| 430 | } |
| 431 | |
| 432 | cmValue cmGeneratorTarget::GetFilePrefixInternal( |
| 433 | std::string const& config, cmStateEnums::ArtifactType artifact, |
| 434 | std::string const& language) const |
| 435 | { |
| 436 | // no prefix for non-main target types. |
| 437 | if (this->GetType() != cmStateEnums::STATIC_LIBRARY && |
| 438 | this->GetType() != cmStateEnums::SHARED_LIBRARY && |
| 439 | this->GetType() != cmStateEnums::MODULE_LIBRARY && |
| 440 | this->GetType() != cmStateEnums::EXECUTABLE) { |
| 441 | return nullptr; |
| 442 | } |
| 443 | |
| 444 | bool const isImportedLibraryArtifact = |
| 445 | (artifact == cmStateEnums::ImportLibraryArtifact); |
| 446 | |
| 447 | // Return an empty prefix for the import library if this platform |
| 448 | // does not support import libraries. |
| 449 | if (isImportedLibraryArtifact && !this->NeedImportLibraryName(config)) { |
| 450 | return nullptr; |
| 451 | } |
| 452 | |
| 453 | // The implib option is only allowed for shared libraries, module |
| 454 | // libraries, and executables. |
| 455 | if (this->GetType() != cmStateEnums::SHARED_LIBRARY && |
| 456 | this->GetType() != cmStateEnums::MODULE_LIBRARY && |
| 457 | this->GetType() != cmStateEnums::EXECUTABLE) { |
| 458 | artifact = cmStateEnums::RuntimeBinaryArtifact; |
| 459 | } |
| 460 | |
| 461 | // Compute prefix value. |
| 462 | cmValue targetPrefix = |
| 463 | (isImportedLibraryArtifact ? this->GetProperty("IMPORT_PREFIX") |
| 464 | : this->GetProperty("PREFIX")); |
| 465 | |
| 466 | if (!targetPrefix) { |
| 467 | char const* prefixVar = this->Target->GetPrefixVariableInternal(artifact); |
| 468 | if (!language.empty() && cmNonempty(prefixVar)) { |
| 469 | std::string langPrefix = cmStrCat(prefixVar, '_', language); |
| 470 | targetPrefix = this->Makefile->GetDefinition(langPrefix); |
| 471 | } |
| 472 | |
| 473 | // if there is no prefix on the target nor specific language |
| 474 | // use the cmake definition. |
| 475 | if (!targetPrefix && prefixVar) { |
| 476 | targetPrefix = this->Makefile->GetDefinition(prefixVar); |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | return targetPrefix; |
| 481 | } |
| 482 | |
| 483 | cmValue cmGeneratorTarget::GetFileSuffixInternal( |
| 484 | std::string const& config, cmStateEnums::ArtifactType artifact, |
no test coverage detected