1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01: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 committed by Ethan Lee
parent a83e83ca1b
commit 1312c10d11

View file

@ -11,13 +11,13 @@ OPTION(ENABLE_WERROR "Treat compilation warnings as errors" OFF)
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(NOT CMAKE_OSX_SYSROOT)
IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH}) IF(IS_DIRECTORY ${OSX_10_9_SDK_PATH})
SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH}) SET(CMAKE_OSX_SYSROOT ${OSX_10_9_SDK_PATH})
ELSE() ELSE()
MESSAGE(WARNING "macOS 10.9 SDK not found - proceeding with the default SDK. This may cause issues!") MESSAGE(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
SET(CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) 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)
@ -25,6 +25,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)