From 1312c10d118c6ec82576fc61f7ff746d3523a256 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sat, 11 Jan 2020 13:40:07 +0100 Subject: [PATCH] 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. --- desktop_version/CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index 16c25c85..f65573f9 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -11,13 +11,13 @@ OPTION(ENABLE_WERROR "Treat compilation warnings as errors" OFF) 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) @@ -25,6 +25,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)