Do not hardcode default macOS SDK path
Doing this is not necessary as CMake already looks up the default one correctly and in fact breaks whenever you have multiple Xcode versions installed so Xcode is not called Xcode.app. (And it does not respect the default Xcode set using xcode-select) The behavior now is to respect CMAKE_OSX_SYSROOT if set by the user on the command line. If it's not set, try to use the hardcoded path to the 10.9 SDK if it's present. If not, warn about the fact that a different SDK is used.
This commit is contained in:
parent
441955de5f
commit
8ff71816e3
|
@ -7,13 +7,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
|
|||
IF(APPLE)
|
||||
# Wow, Apple is a huge jerk these days huh?
|
||||
SET(OSX_10_9_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
|
||||
IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
|
||||
SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
|
||||
ELSE()
|
||||
MESSAGE(WARNING "macOS 10.9 SDK not found - proceeding with the default SDK. This may cause issues!")
|
||||
SET(CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
|
||||
IF(NOT CMAKE_OSX_SYSROOT)
|
||||
IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
|
||||
SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
|
||||
ELSE()
|
||||
MESSAGE(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
|
||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
|
||||
LINK_DIRECTORIES(/usr/local/lib)
|
||||
ADD_COMPILE_OPTIONS(-Werror=partial-availability)
|
||||
|
@ -21,6 +21,10 @@ ENDIF()
|
|||
|
||||
PROJECT(VVVVVV)
|
||||
|
||||
IF(APPLE)
|
||||
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
|
||||
ENDIF()
|
||||
|
||||
# Compiler Flags
|
||||
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_DEFAULT=0 -DPHYSFS_SUPPORTS_ZIP=1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue