diff options
author | David Cole <david.cole@kitware.com> | 2012-08-13 17:28:49 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-08-13 17:28:49 (GMT) |
commit | f0295575d7fa4b554abc4d6b2af07b9f6cbde437 (patch) | |
tree | 79e21e6d85d733e4bbf4b1176c801d4361d0c87d | |
parent | e0f7d7fe5a52613bc23cc596fbf6bde8f54f367a (diff) | |
parent | e88bae77c3388a5b474b081e572004f02772d162 (diff) | |
download | CMake-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.cxx | 19 |
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"); |