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

Function StaticLibraryCycle

Source/cmQtAutoGenInitializer.cxx:102–141  ·  view source on GitHub ↗

* Tests if targetDepend is a STATIC_LIBRARY and if any of its * recursive STATIC_LIBRARY dependencies depends on targetOrigin * (STATIC_LIBRARY cycle). */

Source from the content-addressed store, hash-verified

100 * (STATIC_LIBRARY cycle).
101 */
102bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
103 cmGeneratorTarget const* targetDepend,
104 std::string const& config)
105{
106 bool cycle = false;
107 if ((targetOrigin->GetType() == cmStateEnums::STATIC_LIBRARY) &&
108 (targetDepend->GetType() == cmStateEnums::STATIC_LIBRARY)) {
109 std::set<cmGeneratorTarget const*> knownLibs;
110 std::deque<cmGeneratorTarget const*> testLibs;
111
112 // Insert initial static_library dependency
113 knownLibs.insert(targetDepend);
114 testLibs.push_back(targetDepend);
115
116 while (!testLibs.empty()) {
117 cmGeneratorTarget const* testTarget = testLibs.front();
118 testLibs.pop_front();
119 // Check if the test target is the origin target (cycle)
120 if (testTarget == targetOrigin) {
121 cycle = true;
122 break;
123 }
124 // Collect all static_library dependencies from the test target
125 cmLinkImplementationLibraries const* libs =
126 testTarget->GetLinkImplementationLibraries(
127 config, cmGeneratorTarget::UseTo::Link);
128 if (libs) {
129 for (cmLinkItem const& item : libs->Libraries) {
130 cmGeneratorTarget const* depTarget = item.Target;
131 if (depTarget &&
132 (depTarget->GetType() == cmStateEnums::STATIC_LIBRARY) &&
133 knownLibs.insert(depTarget).second) {
134 testLibs.push_back(depTarget);
135 }
136 }
137 }
138 }
139 }
140 return cycle;
141}
142
143/** Sanitizes file search paths. */
144class SearchPathSanitizer

Callers 1

InitAutogenTargetMethod · 0.85

Calls 7

push_backMethod · 0.80
pop_frontMethod · 0.80
GetTypeMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…