Improved cmake for OS X 10.5

This commit is contained in:
Marco Antognini 2011-07-03 18:45:51 +02:00
parent 202e41c80c
commit de70f691e1
2 changed files with 12 additions and 3 deletions

View File

@ -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()

View File

@ -6,6 +6,15 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
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()