Fix check_include_file return unexpected result (#563)

Don't overwrite existing CMAKE_TRY_COMPILE_PLATFORM_VARIABLES values.
This commit is contained in:
HALX99 2021-05-13 16:43:39 +08:00 committed by GitHub
parent 2f0e37bc24
commit 44d58bc69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,14 +2,6 @@
cmake_minimum_required(VERSION 3.0.2)
# The workaround for try_compile failing with code signing
# since cmake-3.18.2, not required
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED"
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
# Fix compile failure with armv7 deployment target >= 11.0, xcode clang will
# report:
# error: invalid iOS deployment version '--target=armv7-apple-ios13.6',
@ -17,6 +9,14 @@ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
# If CMAKE_OSX_DEPLOYMENT_TARGET is not defined, cmake will choose latest
# deployment target
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
# The workaround for try_compile failing with code signing
# since cmake-3.18.2, not required
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
${CMAKE_TRY_COMPILE_PLATFORM_VARIABLES}
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED"
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ".*armv7.*")
if(NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET
OR NOT CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "11.0")