OtherTests.cmake: check for cross-compile, not for toolchain

Build systems like vcpkg alway sets `CMAKE_TOOLCHAIN_FILE` so it should
not be used as a sign that this is a cross-compile.

Also indented the function correctly.

Reported-by: Philip Chan
Fixes #9921
Closes #9923
This commit is contained in:
Daniel Stenberg 2022-11-16 08:16:46 +01:00
parent df00df1e60
commit 14d5589032
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -85,7 +85,7 @@ endif()
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(NOT CMAKE_CROSSCOMPILING)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "iOS")
# only try this on non-apple platforms