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

Method CreateGlobalGenerator

Source/cmGlobalXCodeGenerator.cxx:210–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210std::unique_ptr<cmGlobalGenerator>
211cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(std::string const& name,
212 cmake* cm) const
213{
214 if (name != GetActualName()) {
215 return std::unique_ptr<cmGlobalGenerator>();
216 }
217#if !defined(CMAKE_BOOTSTRAP)
218 cmXcodeVersionParser parser;
219 std::string versionFile;
220 {
221 std::string out;
222 bool commandResult = cmSystemTools::RunSingleCommand(
223 "xcode-select --print-path", &out, nullptr, nullptr, nullptr,
224 cmSystemTools::OUTPUT_NONE);
225 if (commandResult) {
226 std::string::size_type pos = out.find(".app/");
227 if (pos != std::string::npos) {
228 versionFile =
229 cmStrCat(out.substr(0, pos + 5), "Contents/version.plist");
230 }
231 }
232 }
233 if (!versionFile.empty() && cmSystemTools::FileExists(versionFile)) {
234 parser.ParseFile(versionFile.c_str());
235 } else if (cmSystemTools::FileExists(
236 "/Applications/Xcode.app/Contents/version.plist")) {
237 parser.ParseFile("/Applications/Xcode.app/Contents/version.plist");
238 } else {
239 parser.ParseFile(
240 "/Developer/Applications/Xcode.app/Contents/version.plist");
241 }
242 std::string const& version_string = parser.Version;
243
244 // Compute an integer form of the version number.
245 unsigned int v[2] = { 0, 0 };
246 sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]);
247 unsigned int version_number = 10 * v[0] + v[1];
248
249 if (version_number < 50) {
250 cm->IssueMessage(MessageType::FATAL_ERROR,
251 cmStrCat("Xcode ", version_string, " not supported."));
252 return std::unique_ptr<cmGlobalGenerator>();
253 }
254
255 return std::unique_ptr<cmGlobalGenerator>(
256 cm::make_unique<cmGlobalXCodeGenerator>(cm, version_string,
257 version_number));
258#else
259 std::cerr << "CMake should be built with cmake to use Xcode, "
260 "default to Xcode 1.5\n";
261 return std::unique_ptr<cmGlobalGenerator>(
262 cm::make_unique<cmGlobalXCodeGenerator>(cm));
263#endif
264}
265
266namespace {
267std::string ConvertToMakefilePath(std::string const& path)

Callers

nothing calls this directly

Calls 8

c_strMethod · 0.80
cmStrCatFunction · 0.70
FileExistsFunction · 0.50
findMethod · 0.45
substrMethod · 0.45
emptyMethod · 0.45
ParseFileMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected