Commit 82617e74 authored by Jay Satiro's avatar Jay Satiro
Browse files

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.
parent 11049e00
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities)
include(Macros)
include(CMakeDependentOption)

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(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF)
option(ENABLE_ARES "Set to ON to enable c-ares support" 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_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF)

@@ -250,6 +257,9 @@ if(WIN32)
endif(WIN32)

if(ENABLE_THREADED_RESOLVER)
  if(WIN32)
    set(USE_THREADS_WIN32 ON)
  else()
    check_include_file_concat("pthread.h" HAVE_PTHREAD_H)
    if(HAVE_PTHREAD_H)
      set(CMAKE_THREAD_PREFER_PTHREAD 1)
@@ -260,6 +270,7 @@ if(ENABLE_THREADED_RESOLVER)
      endif()
    endif()
  endif()
endif()

# Check for all needed libraries
check_library_exists_concat("dl"     dlopen       HAVE_LIBDL)
@@ -1062,7 +1073,7 @@ _add_if("OpenSSL" SSL_ENABLED AND USE_OPENSSL)
_add_if("IPv6"          ENABLE_IPV6)
_add_if("unix-sockets"  USE_UNIX_SOCKETS)
_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("Largefile"     (CURL_SIZEOF_CURL_OFF_T GREATER 4) AND
                        ((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
+3 −0
Original line number Diff line number Diff line
@@ -906,6 +906,9 @@
/* Define if you want to enable POSIX threaded DNS lookup */
#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. */
#cmakedefine USE_BLOCKING_SOCKETS 1