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

Method DumpToolchainVariable

Source/cmFileAPIToolchains.cxx:121–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void Toolchains::DumpToolchainVariable(cmMakefile const* mf,
122 Json::Value& object,
123 std::string const& lang,
124 ToolchainVariable const& variable)
125{
126 std::string const variableName =
127 cmStrCat("CMAKE_", lang, '_', variable.VariableSuffix);
128
129 if (variable.IsList) {
130 cmValue data = mf->GetDefinition(variableName);
131 if (data) {
132 cmList values(data);
133 if (!variable.OmitEmpty || !values.empty()) {
134 Json::Value jsonArray = Json::arrayValue;
135 for (auto const& value : values) {
136 jsonArray.append(value);
137 }
138 object[variable.ObjectKey] = jsonArray;
139 }
140 }
141 } else {
142 cmValue def = mf->GetDefinition(variableName);
143 if (def && (!variable.OmitEmpty || !def.IsEmpty())) {
144 object[variable.ObjectKey] = *def;
145 }
146 }
147}
148}
149
150Json::Value cmFileAPIToolchainsDump(cmFileAPI& fileAPI, unsigned int version)

Callers 2

DumpToolchainMethod · 0.95

Calls 5

appendMethod · 0.80
cmStrCatFunction · 0.70
GetDefinitionMethod · 0.45
emptyMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected