| 59 | #undef ENFORCE_EXCLUSIVE |
| 60 | |
| 61 | bool cmProjectInfoArguments::SetMetadataFromProject(cmExecutionStatus& status) |
| 62 | { |
| 63 | // Determine what project to use for inherited metadata. |
| 64 | if (!this->SetEffectiveProject(status)) { |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | if (this->ProjectName.empty()) { |
| 69 | // We are not inheriting from a project. |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | cmMakefile& mf = status.GetMakefile(); |
| 74 | auto mapProjectValue = [&](std::string& arg, cm::string_view suffix) { |
| 75 | cmValue const& projectValue = |
| 76 | mf.GetDefinition(cmStrCat(this->ProjectName, '_', suffix)); |
| 77 | if (projectValue) { |
| 78 | arg = *projectValue; |
| 79 | return true; |
| 80 | } |
| 81 | return false; |
| 82 | }; |
| 83 | |
| 84 | if (this->Version.empty()) { |
| 85 | if (mapProjectValue(this->Version, "VERSION"_s)) { |
| 86 | mapProjectValue(this->VersionCompat, "COMPAT_VERSION"_s); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | if (this->License.empty()) { |
| 91 | mapProjectValue(this->License, "SPDX_LICENSE"_s); |
| 92 | } |
| 93 | |
| 94 | if (this->Description.empty()) { |
| 95 | mapProjectValue(this->Description, "DESCRIPTION"_s); |
| 96 | } |
| 97 | |
| 98 | if (this->Website.empty()) { |
| 99 | mapProjectValue(this->Website, "HOMEPAGE_URL"_s); |
| 100 | } |
| 101 | |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | bool cmProjectInfoArguments::SetEffectiveProject(cmExecutionStatus& status) |
| 106 | { |
no test coverage detected