]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: fix generation for system name iOS
authorMark Sinkovics <sinkovics.mark@gmail.com>
Thu, 14 Dec 2023 00:49:55 +0000 (19:49 -0500)
committerViktor Szakats <commit@vsz.me>
Sat, 16 Dec 2023 22:04:40 +0000 (22:04 +0000)
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

index f769b9547779b5216d7b5294f48fa87fc9745356..cf0bae6b9806e62fec1b2c25e243eaa3d1f75d78 100644 (file)
@@ -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