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

Method WriteEvent

Source/cmFindBase.cxx:735–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733
734#ifndef CMAKE_BOOTSTRAP
735void cmFindBaseDebugState::WriteEvent(cmConfigureLog& log,
736 cmMakefile const& mf) const
737{
738 log.BeginEvent("find-v1", mf);
739
740 // Mode is the Command name without the "find_" prefix
741 log.WriteValue("mode"_s, this->CommandName.substr(5));
742 log.WriteValue("variable"_s, this->FindBaseCommand->VariableName);
743 log.WriteValue("description"_s,
744 this->FindBaseCommand->VariableDocumentation);
745
746 // Yes, this needs to return a `std::string`. If it returns a `const char*`,
747 // the `WriteValue` method prefers the `bool` overload. There's no overload
748 // for a `cm::string_view` because the underlying JSON library doesn't
749 // support `string_view` arguments itself.
750 auto search_opt_to_str = [](bool first, bool last,
751 bool only) -> std::string {
752 return first ? "FIRST" : (last ? "LAST" : (only ? "ONLY" : "NEVER"));
753 };
754 log.BeginObject("settings"_s);
755 log.WriteValue("SearchFramework"_s,
756 search_opt_to_str(this->FindCommand->SearchFrameworkFirst,
757 this->FindCommand->SearchFrameworkLast,
758 this->FindCommand->SearchFrameworkOnly));
759 log.WriteValue("SearchAppBundle"_s,
760 search_opt_to_str(this->FindCommand->SearchAppBundleFirst,
761 this->FindCommand->SearchAppBundleLast,
762 this->FindCommand->SearchAppBundleOnly));
763 log.WriteValue("CMAKE_FIND_USE_CMAKE_PATH"_s,
764 !this->FindCommand->NoCMakePath);
765 log.WriteValue("CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH"_s,
766 !this->FindCommand->NoCMakeEnvironmentPath);
767 log.WriteValue("CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH"_s,
768 !this->FindCommand->NoSystemEnvironmentPath);
769 log.WriteValue("CMAKE_FIND_USE_CMAKE_SYSTEM_PATH"_s,
770 !this->FindCommand->NoCMakeSystemPath);
771 log.WriteValue("CMAKE_FIND_USE_INSTALL_PREFIX"_s,
772 !this->FindCommand->NoCMakeInstallPath);
773 log.EndObject();
774
775 if (!this->FindBaseCommand->Names.empty()) {
776 log.WriteValue("names"_s, this->FindBaseCommand->Names);
777 }
778 std::vector<std::string> directories;
779 directories.reserve(this->FailedSearchLocations.size());
780 for (auto const& location : this->FailedSearchLocations) {
781 directories.push_back(location.path);
782 }
783 if (!this->FindCommand->SearchPaths.empty()) {
784 log.WriteValue("candidate_directories"_s, this->FindCommand->SearchPaths);
785 }
786 if (!directories.empty()) {
787 log.WriteValue("searched_directories"_s, directories);
788 }
789 if (!this->FoundSearchLocation.path.empty()) {
790 log.WriteValue("found"_s, this->FoundSearchLocation.path);
791 } else {
792 log.WriteValue("found"_s, false);

Callers 1

WriteMethod · 0.45

Calls 11

BeginEventMethod · 0.80
WriteValueMethod · 0.80
reserveMethod · 0.80
push_backMethod · 0.80
WriteSearchVariablesMethod · 0.80
EndEventMethod · 0.80
substrMethod · 0.45
BeginObjectMethod · 0.45
EndObjectMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected