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

Method SelectSuitableLibrary

Source/cmXcFramework.cxx:176–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176cmXcFrameworkPlistLibrary const* cmXcFrameworkPlist::SelectSuitableLibrary(
177 cmMakefile const& mf, cmListFileBacktrace const& bt) const
178{
179 auto systemName = mf.GetSafeDefinition("CMAKE_SYSTEM_NAME");
180 cm::optional<cmXcFrameworkPlistSupportedPlatformVariant> systemVariant;
181 if (mf.PlatformIsAppleSimulator()) {
182 systemVariant = cmXcFrameworkPlistSupportedPlatformVariant::simulator;
183 }
184 if (mf.PlatformIsAppleCatalyst()) {
185 systemVariant = cmXcFrameworkPlistSupportedPlatformVariant::maccatalyst;
186 }
187
188 for (auto const& lib : this->AvailableLibraries) {
189 std::string supportedSystemName;
190 switch (lib.SupportedPlatform) {
191 case cmXcFrameworkPlistSupportedPlatform::macOS:
192 supportedSystemName = "Darwin";
193 break;
194 case cmXcFrameworkPlistSupportedPlatform::iOS:
195 supportedSystemName = "iOS";
196 break;
197 case cmXcFrameworkPlistSupportedPlatform::tvOS:
198 supportedSystemName = "tvOS";
199 break;
200 case cmXcFrameworkPlistSupportedPlatform::watchOS:
201 supportedSystemName = "watchOS";
202 break;
203 case cmXcFrameworkPlistSupportedPlatform::visionOS:
204 supportedSystemName = "visionOS";
205 break;
206 }
207
208 if (systemName == supportedSystemName &&
209 systemVariant == lib.SupportedPlatformVariant) {
210 return &lib;
211 }
212 }
213
214 mf.GetCMakeInstance()->IssueMessage(
215 MessageType::FATAL_ERROR,
216 cmStrCat("Unable to find suitable library in:\n ", this->Path,
217 "\nfor system name \"", systemName, '"'),
218 bt);
219 return nullptr;
220}

Callers 4

ImportedGetFullPathMethod · 0.80
AddItemMethod · 0.80
AddXcFrameworkItemMethod · 0.80

Calls 5

cmStrCatFunction · 0.70
IssueMessageMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected