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

Function GetValue

Source/cmCMakeHostSystemInformationCommand.cxx:66–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66cm::optional<std::string> GetValue(cmsys::SystemInformation& info,
67 std::string const& key)
68{
69 if (key == "NUMBER_OF_LOGICAL_CORES"_s) {
70 return ValueToString(info.GetNumberOfLogicalCPU());
71 }
72 if (key == "NUMBER_OF_PHYSICAL_CORES"_s) {
73 return ValueToString(info.GetNumberOfPhysicalCPU());
74 }
75 if (key == "HOSTNAME"_s) {
76 return ValueToString(info.GetHostname());
77 }
78 if (key == "FQDN"_s) {
79 return ValueToString(info.GetFullyQualifiedDomainName());
80 }
81 if (key == "LOCALE_CHARSET"_s) {
82#if defined(_WIN32)
83 // On Windows we always use UTF-8.
84 return ValueToString("UTF-8");
85#else
86 // On non-Windows platforms we use the locale's encoding.
87 if (char const* charset = nl_langinfo(CODESET)) {
88 if (cmsysString_strcasecmp(charset, "utf-8") == 0 ||
89 cmsysString_strcasecmp(charset, "utf8") == 0) {
90 charset = "UTF-8";
91 }
92 return ValueToString(charset);
93 }
94 return ValueToString("");
95#endif
96 }
97 if (key == "TOTAL_VIRTUAL_MEMORY"_s) {
98 return ValueToString(info.GetTotalVirtualMemory());
99 }
100 if (key == "AVAILABLE_VIRTUAL_MEMORY"_s) {
101 return ValueToString(info.GetAvailableVirtualMemory());
102 }
103 if (key == "TOTAL_PHYSICAL_MEMORY"_s) {
104 return ValueToString(info.GetTotalPhysicalMemory());
105 }
106 if (key == "AVAILABLE_PHYSICAL_MEMORY"_s) {
107 return ValueToString(info.GetAvailablePhysicalMemory());
108 }
109 if (key == "IS_64BIT"_s) {
110 return ValueToString(info.Is64Bits());
111 }
112 if (key == "HAS_FPU"_s) {
113 return ValueToString(
114 info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_FPU));
115 }
116 if (key == "HAS_MMX"_s) {
117 return ValueToString(
118 info.DoesCPUSupportFeature(cmsys::SystemInformation::CPU_FEATURE_MMX));
119 }
120 if (key == "HAS_MMX_PLUS"_s) {
121 return ValueToString(info.DoesCPUSupportFeature(
122 cmsys::SystemInformation::CPU_FEATURE_MMX_PLUS));
123 }

Callers 1

Calls 15

ValueToStringFunction · 0.85
GetNumberOfLogicalCPUMethod · 0.80
GetHostnameMethod · 0.80
GetTotalVirtualMemoryMethod · 0.80
Is64BitsMethod · 0.80
DoesCPUSupportFeatureMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…