mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
cmFindBase: skip writing names and *_directories when empty
When the arrays are empty, the YAML ends up with `foo:` which is equivalent to `foo: null`, not `foo: []`. Avoid writing the key when it has no information to provide.
This commit is contained in:
@@ -759,14 +759,20 @@ void cmFindBaseDebugState::WriteEvent(cmConfigureLog& log,
|
|||||||
!this->FindCommand->NoCMakeInstallPath);
|
!this->FindCommand->NoCMakeInstallPath);
|
||||||
log.EndObject();
|
log.EndObject();
|
||||||
|
|
||||||
log.WriteValue("names"_s, this->FindBaseCommand->Names);
|
if (!this->FindBaseCommand->Names.empty()) {
|
||||||
|
log.WriteValue("names"_s, this->FindBaseCommand->Names);
|
||||||
|
}
|
||||||
std::vector<std::string> directories;
|
std::vector<std::string> directories;
|
||||||
directories.reserve(this->FailedSearchLocations.size());
|
directories.reserve(this->FailedSearchLocations.size());
|
||||||
for (auto const& location : this->FailedSearchLocations) {
|
for (auto const& location : this->FailedSearchLocations) {
|
||||||
directories.push_back(location.path);
|
directories.push_back(location.path);
|
||||||
}
|
}
|
||||||
log.WriteValue("candidate_directories"_s, this->FindCommand->SearchPaths);
|
if (!this->FindCommand->SearchPaths.empty()) {
|
||||||
log.WriteValue("searched_directories"_s, directories);
|
log.WriteValue("candidate_directories"_s, this->FindCommand->SearchPaths);
|
||||||
|
}
|
||||||
|
if (!directories.empty()) {
|
||||||
|
log.WriteValue("searched_directories"_s, directories);
|
||||||
|
}
|
||||||
if (!this->FoundSearchLocation.path.empty()) {
|
if (!this->FoundSearchLocation.path.empty()) {
|
||||||
log.WriteValue("found"_s, this->FoundSearchLocation.path);
|
log.WriteValue("found"_s, this->FoundSearchLocation.path);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user