Compiler Feature Detection failure in Xcode 9 for iOS because of armv7 usage
I'm building with Xcode 9 & iOS SDK 11. Starting in SDK 11, armv7 is not supported unless your deployment version is less than 11.0.
I'm targeting armv7 & arm64 and a deployment version of iOS 10.0, so I have the following in my toolchain file:
set (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "10.0" CACHE string "iOS Deployment Target")
set (CMAKE_OSX_ARCHITECTURES "armv7 arm64" CACHE string "Build architecture for iOS")
However my compiler feature detection fails because for some reason this deployment target is not being picked up by the try_compile step.
The following error is then found in the CMakeError.log... emitted for all armv7 targets
clang: error: invalid iOS deployment version '-miphoneos-version-min=11.0', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]
It seems that the initial configuration is not taking into account the CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET
setting, even though the resulting project (for my project) shows the deployment version set as expected. The generated projects in the CMakeFiles
folder do not show this.
Adding -miphoneos-version-min
to the c or cxx flags is ineffective, because the -miphoneos-version-min=11.0
flag is also added, overriding the earlier flag's setting.
If I remove armv7
then the feature detection succeeds.
CMake 3.9.4 MacOS 10.12.6 Xcode 9.0