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

Function HandleHashCommand

Source/cmFileCommand.cxx:261–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261bool HandleHashCommand(std::vector<std::string> const& args,
262 cmExecutionStatus& status)
263{
264#if !defined(CMAKE_BOOTSTRAP)
265 if (args.size() != 3) {
266 status.SetError(
267 cmStrCat(args[0], " requires a file name and output variable"));
268 return false;
269 }
270
271 std::unique_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0]));
272 if (hash) {
273 std::string out = hash->HashFile(args[1]);
274 if (!out.empty()) {
275 status.GetMakefile().AddDefinition(args[2], out);
276 return true;
277 }
278 status.SetError(cmStrCat(args[0], " failed to read file \"", args[1],
279 "\": ", cmSystemTools::GetLastSystemError()));
280 }
281 return false;
282#else
283 status.SetError(cmStrCat(args[0], " not available during bootstrap"));
284 return false;
285#endif
286}
287
288bool HandleStringsCommand(std::vector<std::string> const& args,
289 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 7

HashFileMethod · 0.80
cmStrCatFunction · 0.70
sizeMethod · 0.45
SetErrorMethod · 0.45
emptyMethod · 0.45
AddDefinitionMethod · 0.45
GetMakefileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…