configs: define CMAKE_OSX_DEPLOYMENT_TARGET as minimum between current SDK...

configs: define CMAKE_OSX_DEPLOYMENT_TARGET as minimum between current SDK used and current OSX version, so that if one is using 10.11 with an 10.10 SDK it still work
parent 654fb22d
......@@ -40,9 +40,15 @@ set(DEFAULT_VALUE_CMAKE_LINKING_TYPE "-DENABLE_STATIC=NO")
# Global configuration
set(LINPHONE_BUILDER_HOST "")
if(APPLE)
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) #is it still usefull ?
#without instruction chose to target current machine
execute_process(COMMAND sw_vers -productVersion COMMAND awk -F \\. "{printf \"%i.%i\",$1,$2}" RESULT_VARIABLE xcrun_sdk_version OUTPUT_VARIABLE CMAKE_OSX_DEPLOYMENT_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) #is it still useful?
#without instruction chose to target lower version between current machine and current used SDK
execute_process(COMMAND sw_vers -productVersion COMMAND awk -F \\. "{printf \"%i.%i\",$1,$2}" RESULT_VARIABLE sw_vers_version OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --sdk macosx --show-sdk-version RESULT_VARIABLE xcrun_sdk_version OUTPUT_VARIABLE CURRENT_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${CURRENT_OSX_VERSION} VERSION_LESS ${CURRENT_SDK_VERSION})
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_SDK_VERSION})
endif()
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
......
......@@ -46,9 +46,15 @@ else() # Windows
set(LINPHONE_BUILDER_PKG_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/")
endif()
if(APPLE)
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) #is it still usefull ?
#without instruction chose to target current machine
execute_process(COMMAND sw_vers -productVersion COMMAND awk -F \\. "{printf \"%i.%i\",$1,$2}" RESULT_VARIABLE xcrun_sdk_version OUTPUT_VARIABLE CMAKE_OSX_DEPLOYMENT_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) #is it still useful?
#without instruction chose to target lower version between current machine and current used SDK
execute_process(COMMAND sw_vers -productVersion COMMAND awk -F \\. "{printf \"%i.%i\",$1,$2}" RESULT_VARIABLE sw_vers_version OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --sdk macosx --show-sdk-version RESULT_VARIABLE xcrun_sdk_version OUTPUT_VARIABLE CURRENT_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${CURRENT_OSX_VERSION} VERSION_LESS ${CURRENT_SDK_VERSION})
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_SDK_VERSION})
endif()
endif()
set(CMAKE_MACOSX_RPATH 1)
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment