| 103 | } |
| 104 | |
| 105 | bool cmProjectInfoArguments::SetEffectiveProject(cmExecutionStatus& status) |
| 106 | { |
| 107 | if (this->NoProjectDefaults) { |
| 108 | // User requested that metadata not be inherited. |
| 109 | return true; |
| 110 | } |
| 111 | |
| 112 | cmMakefile& mf = status.GetMakefile(); |
| 113 | if (!this->ProjectName.empty()) { |
| 114 | // User specified a project; make sure it exists. |
| 115 | if (!mf.GetStateSnapshot().CheckProjectName(this->ProjectName)) { |
| 116 | status.SetError(cmStrCat(R"(PROJECT given unknown project name ")"_s, |
| 117 | this->ProjectName, R"(".)"_s)); |
| 118 | return false; |
| 119 | } |
| 120 | } else { |
| 121 | // No project was specified; check if the package name is also a project. |
| 122 | std::string project = mf.GetStateSnapshot().GetProjectName(); |
| 123 | if (this->PackageName == project) { |
| 124 | this->ProjectName = std::move(project); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return true; |
| 129 | } |
no test coverage detected