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

Method AddHeaderSetVerification

Source/cmGeneratorTarget.cxx:5749–5984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5747}
5748
5749bool cmGeneratorTarget::AddHeaderSetVerification()
5750{
5751 for (bool const isInterface : { false, true }) {
5752 if (!this->GetPropertyAsBool(isInterface ? "VERIFY_INTERFACE_HEADER_SETS"
5753 : "VERIFY_PRIVATE_HEADER_SETS")) {
5754 continue;
5755 }
5756
5757 if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
5758 this->GetType() != cmStateEnums::SHARED_LIBRARY &&
5759 (this->GetType() != cmStateEnums::MODULE_LIBRARY || isInterface) &&
5760 this->GetType() != cmStateEnums::UNKNOWN_LIBRARY &&
5761 this->GetType() != cmStateEnums::OBJECT_LIBRARY &&
5762 this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
5763 this->GetType() != cmStateEnums::EXECUTABLE) {
5764 continue;
5765 }
5766
5767 char const* headerSetsProperty = isInterface
5768 ? "INTERFACE_HEADER_SETS_TO_VERIFY"
5769 : "PRIVATE_HEADER_SETS_TO_VERIFY";
5770
5771 auto verifyValue = this->GetProperty(headerSetsProperty);
5772 bool const all = verifyValue.IsEmpty();
5773 std::set<std::string> verifySet;
5774 if (!all) {
5775 cmList verifyList{ verifyValue };
5776 verifySet.insert(verifyList.begin(), verifyList.end());
5777 }
5778
5779 cmTarget* verifyTarget = nullptr;
5780 std::string const verifyTargetName =
5781 cmStrCat(this->GetName(),
5782 isInterface ? "_verify_interface_header_sets"
5783 : "_verify_private_header_sets");
5784
5785 char const* allVerifyTargetName = isInterface
5786 ? "all_verify_interface_header_sets"
5787 : "all_verify_private_header_sets";
5788 cmTarget* allVerifyTarget =
5789 this->GlobalGenerator->GetMakefiles().front()->FindTargetToUse(
5790 allVerifyTargetName, { cmStateEnums::TargetDomain::NATIVE });
5791
5792 auto fileSetEntries = isInterface
5793 ? this->Target->GetInterfaceHeaderSetsEntries()
5794 : this->Target->GetHeaderSetsEntries();
5795
5796 std::set<cmFileSet*> fileSets;
5797 for (auto const& entry : fileSetEntries) {
5798 for (auto const& name : cmList{ entry.Value }) {
5799 if (all || verifySet.count(name)) {
5800 fileSets.insert(this->Target->GetFileSet(name));
5801 verifySet.erase(name);
5802 }
5803 }
5804 }
5805
5806 if (isInterface) {

Callers

nothing calls this directly

Calls 15

GetPropertyAsBoolMethod · 0.95
GetTypeMethod · 0.95
GetPropertyMethod · 0.95
FindTargetToUseMethod · 0.80
GetHeaderSetsEntriesMethod · 0.80
eraseMethod · 0.80
CompileFileEntriesMethod · 0.80
GetGeneratorConfigsMethod · 0.80

Tested by

no test coverage detected