endif()
endmacro()
-set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
cmake_push_check_state()
return 0;
}" HAVE_STRUCT_TIMEVAL)
-unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
+unset(_cmake_try_compile_target_type_save)
# Detect HAVE_GETADDRINFO_THREADSAFE
return 0;
}" HAVE_CLOCK_GETTIME_MONOTONIC_RAW)
endif()
+
+unset(_source_epilogue)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 0)
endif()
+# Having CMAKE_TRY_COMPILE_TARGET_TYPE set to STATIC_LIBRARY breaks certain
+# 'check_function_exists()' detections (possibly more), by detecting
+# non-existing features. This happens by default when using 'ios.toolchain.cmake'.
+# Work it around by setting this value to `EXECUTABLE`.
+if(CMAKE_TRY_COMPILE_TARGET_TYPE STREQUAL "STATIC_LIBRARY")
+ message(STATUS "CMAKE_TRY_COMPILE_TARGET_TYPE was found set to STATIC_LIBRARY. "
+ "Overriding with EXECUTABLE for feature detections to work.")
+ set(_cmake_try_compile_target_type_save ${CMAKE_TRY_COMPILE_TARGET_TYPE})
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE "EXECUTABLE")
+endif()
+
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
option(PICKY_COMPILER "Enable picky compiler options" ON)
option(BUILD_CURL_EXE "Build curl executable" ON)
# Preload settings on Windows
if(WIN32)
include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake")
+elseif(APPLE)
+ # Fast-track predicable feature detections
+ set(HAVE_EVENTFD 0)
+ set(HAVE_GETPASS_R 0)
+ set(HAVE_SENDMMSG 0)
endif()
if(ENABLE_THREADED_RESOLVER)
endif()
# Check for all needed libraries
-if(NOT WIN32)
+if(NOT WIN32 AND NOT APPLE)
check_library_exists("socket" "connect" "" HAVE_LIBSOCKET)
if(HAVE_LIBSOCKET)
set(CURL_LIBS "socket;${CURL_LIBS}")
endif()
endif()
+if(_cmake_try_compile_target_type_save)
+ set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
+ unset(_cmake_try_compile_target_type_save)
+endif()
+
include(CMake/OtherTests.cmake)
add_definitions("-DHAVE_CONFIG_H")