1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-03 03:23:33 +02:00

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:
Marvin Scholz 2020-01-11 13:40:07 +01:00
parent 441955de5f
commit 8ff71816e3

View File

@ -7,13 +7,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
IF(APPLE) IF(APPLE)
# Wow, Apple is a huge jerk these days huh? # 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) 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}) IF(NOT CMAKE_OSX_SYSROOT)
SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH}) IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
ELSE() SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
MESSAGE(WARNING "macOS 10.9 SDK not found - proceeding with the default SDK. This may cause issues!") ELSE()
SET(CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) MESSAGE(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
ENDIF()
ENDIF() ENDIF()
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
LINK_DIRECTORIES(/usr/local/lib) LINK_DIRECTORIES(/usr/local/lib)
ADD_COMPILE_OPTIONS(-Werror=partial-availability) ADD_COMPILE_OPTIONS(-Werror=partial-availability)
@ -21,6 +21,10 @@ ENDIF()
PROJECT(VVVVVV) PROJECT(VVVVVV)
IF(APPLE)
MESSAGE(STATUS "Using macOS SDK at ${CMAKE_OSX_SYSROOT}")
ENDIF()
# Compiler Flags # Compiler Flags
ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_DEFAULT=0 -DPHYSFS_SUPPORTS_ZIP=1) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_DEFAULT=0 -DPHYSFS_SUPPORTS_ZIP=1)