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

Method AddRuleHash

Source/cmGlobalGenerator.cxx:3712–3734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3710}
3711
3712void cmGlobalGenerator::AddRuleHash(std::vector<std::string> const& outputs,
3713 std::string const& content)
3714{
3715 // Ignore if there are no outputs.
3716 if (outputs.empty()) {
3717 return;
3718 }
3719
3720 // Compute a hash of the rule.
3721 RuleHash hash;
3722 {
3723 cmCryptoHash md5(cmCryptoHash::AlgoMD5);
3724 std::string const md5_hex = md5.HashString(content);
3725 memcpy(hash.Data, md5_hex.c_str(), 32);
3726 }
3727
3728 // Shorten the output name (in expected use case).
3729 std::string fname =
3730 this->LocalGenerators[0]->MaybeRelativeToTopBinDir(outputs[0]);
3731
3732 // Associate the hash with this output.
3733 this->RuleHashes[fname] = hash;
3734}
3735
3736void cmGlobalGenerator::CheckRuleHashes()
3737{

Callers 1

Calls 4

HashStringMethod · 0.80
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected