Commit f0295575 authored by David Cole's avatar David Cole Committed by Kitware Robot
Browse files

Merge topic 'xcode-select'

e88bae77 Xcode: Run xcode-select to find Xcode version file (#13463)
parents e0f7d7fe e88bae77
...@@ -136,8 +136,23 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New() ...@@ -136,8 +136,23 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New()
{ {
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser; cmXcodeVersionParser parser;
if (cmSystemTools::FileExists( std::string versionFile;
"/Applications/Xcode.app/Contents/version.plist")) {
std::string out;
std::string::size_type pos;
if(cmSystemTools::RunSingleCommand("xcode-select --print-path", &out, 0, 0,
cmSystemTools::OUTPUT_NONE) &&
(pos = out.find(".app/"), pos != out.npos))
{
versionFile = out.substr(0, pos+5)+"Contents/version.plist";
}
}
if(!versionFile.empty() && cmSystemTools::FileExists(versionFile.c_str()))
{
parser.ParseFile(versionFile.c_str());
}
else if (cmSystemTools::FileExists(
"/Applications/Xcode.app/Contents/version.plist"))
{ {
parser.ParseFile parser.ParseFile
("/Applications/Xcode.app/Contents/version.plist"); ("/Applications/Xcode.app/Contents/version.plist");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment