From de70f691e10b502e09d1683b2d241d559f199948 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Sun, 3 Jul 2011 18:45:51 +0200 Subject: [PATCH] Improved cmake for OS X 10.5 --- CMakeLists.txt | 4 ++-- cmake/Config.cmake | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e148948..66dd6a37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,8 @@ set(BUILD_EXAMPLES FALSE CACHE BOOL "TRUE to build the SFML examples, FALSE to i set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it") # Mac OS X specific options -if (MACOSX) - # add an option to build against 10.5 SDK +if (MACOSX AND MACOSX_VERSION GREATER 5) + # add an option to build against 10.5 SDK if current OS X version is greater than 10.5 set(BUILD_LEOPARD FALSE CACHE BOOL "TRUE to build SFML for OS X 10.5, FALSE to compile with default SDK") endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 23668365..4b80e57e 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -5,7 +5,16 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LINUX 1) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(MACOSX 1) + set(MACOSX 1) + + # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.) + EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) + STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") + if(${MACOSX_VERSION} LESS 5) + message(WARNING "Unsupported version of OS X : ${MACOSX_VERSION_RAW}") + return() + endif() + else() message(WARNING "Unsupported operating system") return()