From a86254b39307af1a53735b065a382567805cd9b8 Mon Sep 17 00:00:00 2001 From: Mark Sinkovics Date: Wed, 13 Dec 2023 19:49:55 -0500 Subject: [PATCH] cmake: fix generation for system name iOS This PR fixes a problem that happens during CMake configuration when the `CMAKE_SYSTEM_NAME` set to `iOS` and not `Darwin`. This value is available (as far as I remember) version 3.14. The final solution (thanks to @vszakats) is to use `APPLE` which contains all the Apple platforms https://cmake.org/cmake/help/latest/variable/APPLE.html. This issue was found when during vcpkg installation. Running command `vcpkg install curl:arm64-ios` and `vcpkg install curl:x64-ios` failed with message: ``` CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately: HAVE_H_ERRNO_ASSIGNABLE_EXITCODE (advanced) ``` After this fix, I was able to compile the compile the binary without any issue. In addition to that fix, this PR also contains an simplification to check if the platform is not APPLE. Co-authored-by: Viktor Szakats Closes #12515 --- CMake/OtherTests.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake index f769b95477..cf0bae6b98 100644 --- a/CMake/OtherTests.cmake +++ b/CMake/OtherTests.cmake @@ -80,7 +80,7 @@ endif() unset(CMAKE_TRY_COMPILE_TARGET_TYPE) if(NOT CMAKE_CROSSCOMPILING) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "iOS") + if(NOT APPLE) # only try this on non-apple platforms # if not cross-compilation... @@ -133,8 +133,8 @@ if(WIN32) set(HAVE_GETADDRINFO_THREADSAFE ${HAVE_GETADDRINFO}) elseif(NOT HAVE_GETADDRINFO) set(HAVE_GETADDRINFO_THREADSAFE FALSE) -elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR - CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR +elseif(APPLE OR + CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "HP-UX" OR CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" OR