Fix iOS SDK version detection for Xcode 7 by phatblat · Pull Request #502 · libgit2/objective-git (original) (raw)

Without this change, update_libgit2_ios reports building for iphonesimulator2.0 when using Xcode 7

Building for x86_64 i386 armv7 armv7s arm64
Building libgit2 for iphonesimulator2.0 x86_64
Please stand by...
/Users/phatblat/dev/ios/Octopad/Carthage/Checkouts/objective-git/External/libgit2-ios/iphonesimulator2.0-x86_64.sdk/build-libgit2.log

And the build randomly fails (Xcode GUI fails on first architecture, command line builds get through those but fail on the first ARM architecture).

-- The C compiler identification is AppleClang 7.0.0.7000065
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
...
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
CMake Error at /usr/local/Cellar/cmake/3.3.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.3.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.3.0/share/cmake/Modules/FindThreads.cmake:204 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:458 (FIND_PACKAGE)

👌 This change is compatible with Xcode 6.3 and 6.4.

DEVELOPER_DIR=/Applications/Xcode7-beta5.app xcodebuild -version -sdk | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
9.0

DEVELOPER_DIR=/Applications/Xcode6.4.app xcodebuild -version -sdk | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
8.4 

DEVELOPER_DIR=/Applications/Xcode6.3.2.app xcodebuild -version -sdk | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
8.3

The new WatchOS2.0.sdk and WatchSimulator2.0.sdk broke the assumption that the iPhone SDK was last in the list.