From: Viktor Szakats Date: Thu, 26 Oct 2023 08:28:20 +0000 (+0000) Subject: cmake: speed up threads setup for Windows X-Git-Tag: curl-8_5_0~192 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=191e695fe4bbb77a188e1942b0b9de6e93063cc0;p=thirdparty%2Fcurl.git cmake: speed up threads setup for Windows Win32 threads are always available. We enabled them unconditionally (with `ENABLE_THREADED_RESOLVER`). CMake built-in thread detection logic has this condition hard-coded for Windows as well (since at least 2007). Instead of doing all the work of detecting pthread combinations on Windows, then discarding those results, skip these efforts and assume built-in thread support when building for Windows. This saves 1-3 slow CMake configuration steps. Reviewed-by: Daniel Stenberg Closes #12202 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f2cf36ffd..22832a5bcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -369,14 +369,14 @@ if(WIN32) endif() if(ENABLE_THREADED_RESOLVER) - find_package(Threads REQUIRED) if(WIN32) set(USE_THREADS_WIN32 ON) else() + find_package(Threads REQUIRED) set(USE_THREADS_POSIX ${CMAKE_USE_PTHREADS_INIT}) set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) + set(CURL_LIBS ${CURL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif() - set(CURL_LIBS ${CURL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif() # Check for all needed libraries