summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-08-13 17:28:49 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-08-13 17:28:49 (GMT)
commitf0295575d7fa4b554abc4d6b2af07b9f6cbde437 (patch)
tree79e21e6d85d733e4bbf4b1176c801d4361d0c87d
parente0f7d7fe5a52613bc23cc596fbf6bde8f54f367a (diff)
parente88bae77c3388a5b474b081e572004f02772d162 (diff)
downloadCMake-f0295575d7fa4b554abc4d6b2af07b9f6cbde437.zip
CMake-f0295575d7fa4b554abc4d6b2af07b9f6cbde437.tar.gz
CMake-f0295575d7fa4b554abc4d6b2af07b9f6cbde437.tar.bz2
Merge topic 'xcode-select'
e88bae7 Xcode: Run xcode-select to find Xcode version file (#13463)
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c366bcb..ae92a0a 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -136,8 +136,23 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New()
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmXcodeVersionParser parser;
- if (cmSystemTools::FileExists(
- "/Applications/Xcode.app/Contents/version.plist"))
+ std::string versionFile;
+ {
+ 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
("/Applications/Xcode.app/Contents/version.plist");