Fixed: Compilation under Mac OS X (CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT must be set on CMake command-line if needed)

This commit is contained in:
kervala 2013-03-24 19:59:19 +01:00
parent 526da8ddf8
commit a5806126b4

View file

@ -600,22 +600,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF(WIN32) ENDIF(WIN32)
IF(APPLE) IF(APPLE)
IF(IOS) IF(NOT XCODE)
# Disable CMAKE_OSX_DEPLOYMENT_TARGET for iOS
SET(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE PATH "" FORCE)
ELSE(IOS)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE)
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(IOS)
IF(XCODE)
IF(IOS)
SET(CMAKE_OSX_SYSROOT "iphoneos" CACHE PATH "" FORCE)
ELSE(IOS)
# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
ENDIF(IOS)
ELSE(XCODE)
IF(CMAKE_OSX_ARCHITECTURES) IF(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 0) SET(TARGETS_COUNT 0)
SET(_ARCHS) SET(_ARCHS)
@ -791,16 +776,8 @@ MACRO(NL_SETUP_BUILD)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
ELSE(IOS) ELSE(IOS)
FOREACH(_SDK ${_CMAKE_OSX_SDKS})
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
ENDFOREACH(_SDK)
IF(CMAKE_OSX_SYSROOT) IF(CMAKE_OSX_SYSROOT)
ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}") ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}")
ELSE(CMAKE_OSX_SYSROOT)
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
ENDIF(CMAKE_OSX_SYSROOT) ENDIF(CMAKE_OSX_SYSROOT)
# Always force -mmacosx-version-min to override environement variable # Always force -mmacosx-version-min to override environement variable
@ -813,7 +790,7 @@ MACRO(NL_SETUP_BUILD)
IF(HAVE_FLAG_SEARCH_PATHS_FIRST) IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(XCODE) ENDIF(NOT XCODE)
ELSE(APPLE) ELSE(APPLE)
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
ADD_PLATFORM_FLAGS("-m32 -march=i686") ADD_PLATFORM_FLAGS("-m32 -march=i686")