1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

cmake: Enable win32 threaded resolver by default

- Turn on USE_THREADS_WIN32 in Windows if ares isn't on

This change is similar to what we already do in the autotools build.
This commit is contained in:
Jay Satiro 2016-08-08 02:37:29 -04:00
parent 11049e007a
commit 82617e7499
2 changed files with 24 additions and 10 deletions

View File

@ -42,6 +42,7 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities) include(Utilities)
include(Macros) include(Macros)
include(CMakeDependentOption)
project( CURL C ) project( CURL C )
@ -74,8 +75,14 @@ include_directories( ${CURL_SOURCE_DIR}/include )
option(BUILD_CURL_EXE "Set to ON to build cURL executable." ON) option(BUILD_CURL_EXE "Set to ON to build cURL executable." ON)
option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF) option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF)
option(ENABLE_ARES "Set to ON to enable c-ares support" OFF) option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
option(ENABLE_THREADED_RESOLVER "Set to ON to enable POSIX threaded DNS lookup" OFF) if(WIN32)
CMAKE_DEPENDENT_OPTION(ENABLE_THREADED_RESOLVER
"Set to ON to enable threaded DNS lookup"
ON "NOT ENABLE_ARES"
OFF)
else()
option(ENABLE_THREADED_RESOLVER "Set to ON to enable POSIX threaded DNS lookup" OFF)
endif()
option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF) option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF)
option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF) option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF)
@ -250,6 +257,9 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(ENABLE_THREADED_RESOLVER) if(ENABLE_THREADED_RESOLVER)
if(WIN32)
set(USE_THREADS_WIN32 ON)
else()
check_include_file_concat("pthread.h" HAVE_PTHREAD_H) check_include_file_concat("pthread.h" HAVE_PTHREAD_H)
if(HAVE_PTHREAD_H) if(HAVE_PTHREAD_H)
set(CMAKE_THREAD_PREFER_PTHREAD 1) set(CMAKE_THREAD_PREFER_PTHREAD 1)
@ -259,6 +269,7 @@ if(ENABLE_THREADED_RESOLVER)
set(USE_THREADS_POSIX 1) set(USE_THREADS_POSIX 1)
endif() endif()
endif() endif()
endif()
endif() endif()
# Check for all needed libraries # Check for all needed libraries
@ -1062,7 +1073,7 @@ _add_if("OpenSSL" SSL_ENABLED AND USE_OPENSSL)
_add_if("IPv6" ENABLE_IPV6) _add_if("IPv6" ENABLE_IPV6)
_add_if("unix-sockets" USE_UNIX_SOCKETS) _add_if("unix-sockets" USE_UNIX_SOCKETS)
_add_if("libz" HAVE_LIBZ) _add_if("libz" HAVE_LIBZ)
_add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX) _add_if("AsynchDNS" USE_ARES OR USE_THREADS_POSIX OR USE_THREADS_WIN32)
_add_if("IDN" HAVE_LIBIDN) _add_if("IDN" HAVE_LIBIDN)
_add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND _add_if("Largefile" (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND
((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES)) ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))

View File

@ -906,6 +906,9 @@
/* Define if you want to enable POSIX threaded DNS lookup */ /* Define if you want to enable POSIX threaded DNS lookup */
#cmakedefine USE_THREADS_POSIX 1 #cmakedefine USE_THREADS_POSIX 1
/* Define if you want to enable WIN32 threaded DNS lookup */
#cmakedefine USE_THREADS_WIN32 1
/* Define to disable non-blocking sockets. */ /* Define to disable non-blocking sockets. */
#cmakedefine USE_BLOCKING_SOCKETS 1 #cmakedefine USE_BLOCKING_SOCKETS 1