CMake: Fixes/Tweaks for macOS building with C++ 11
Make sure the deployment target is set to 10.9 when using C++11 Also ensure building C++11 on macOS for non Xcode builds
This commit is contained in:
@@ -20,7 +20,12 @@ endif()
|
|||||||
if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
# If no deployment target has been set default to the minimum supported
|
# If no deployment target has been set default to the minimum supported
|
||||||
# OS X version (this has to be set before the first project() call)
|
# OS X version (this has to be set before the first project() call)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7 CACHE STRING "OS X Deployment Target")
|
if(CMAKE_CXX_STANDARD EQUAL 11 OR CMAKE_CXX_STANDARD EQUAL 14)
|
||||||
|
set(OSX_DEFAULT_DEPLOYMENT_TARGET 10.9)
|
||||||
|
else()
|
||||||
|
set(OSX_DEFAULT_DEPLOYMENT_TARGET 10.7)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_DEFAULT_DEPLOYMENT_TARGET} CACHE STRING "OS X Deployment Target")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(wxWidgets)
|
project(wxWidgets)
|
||||||
|
@@ -74,7 +74,13 @@ function(wx_set_common_target_properties target_name)
|
|||||||
# TODO: implement for older CMake versions ?
|
# TODO: implement for older CMake versions ?
|
||||||
set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${wxBUILD_CXX_STANDARD})
|
set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${wxBUILD_CXX_STANDARD})
|
||||||
if(wxBUILD_CXX_STANDARD EQUAL 11 OR wxBUILD_CXX_STANDARD EQUAL 14)
|
if(wxBUILD_CXX_STANDARD EQUAL 11 OR wxBUILD_CXX_STANDARD EQUAL 14)
|
||||||
|
if (APPLE)
|
||||||
|
if(CMAKE_GENERATOR EQUAL "Xcode")
|
||||||
set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY libc++)
|
set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY libc++)
|
||||||
|
else()
|
||||||
|
target_compile_options(${target_name} PUBLIC "-stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
#TODO: define for other generators than Xcode
|
#TODO: define for other generators than Xcode
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -304,7 +310,7 @@ endfunction()
|
|||||||
# Enable cotire for target if precompiled headers are enabled
|
# Enable cotire for target if precompiled headers are enabled
|
||||||
macro(wx_target_enable_precomp target_name)
|
macro(wx_target_enable_precomp target_name)
|
||||||
if(wxBUILD_PRECOMP)
|
if(wxBUILD_PRECOMP)
|
||||||
if(CMAKE_GENERATOR STREQUAL "Xcode" AND ${target_name} STREQUAL "wxscintilla")
|
if(APPLE AND ${target_name} STREQUAL "wxscintilla")
|
||||||
# TODO: workaround/fix cotire issue with wxscintilla when using Xcode
|
# TODO: workaround/fix cotire issue with wxscintilla when using Xcode
|
||||||
else()
|
else()
|
||||||
set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||||
|
Reference in New Issue
Block a user