cmake: speed up threads setup for Windows#12202
Closed
vszakats wants to merge 1 commit into
Closed
Conversation
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 save 2-3 slow detection steps on CMake configuration. Closes #xxxxx
bagder
approved these changes
Oct 26, 2023
vszakats
added a commit
to curl/curl-for-win
that referenced
this pull request
Oct 27, 2023
Stop pre-filling values that are no longer used by the next curl release. Ref: curl/curl#12200 `HAVE_ZSTD_CREATEDSTREAM` curl/curl#12202 `THREADS_HAVE_PTHREAD_ARG` `CMAKE_HAVE_LIBC_PTHREAD` `CMAKE_HAVE_PTHREADS_CREATE` `CMAKE_HAVE_PTHREAD_CREATE` curl/curl#12210 `DHAVE_VARIADIC_MACROS_C99` `HAVE_VARIADIC_MACROS_GCC`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Win32 threads are always available. We enabled them unconditionally
(with
ENABLE_THREADED_RESOLVER). CMake built-in thread detectionlogic 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.
Closes #12202
The side effect is that on some targets
phtreadis no longer linkedautomatically to curl even when curl itself did not require or use it.
This was seen to happen with mingw-w64 on x86 and arm64 targets
(but not with x64), causing the
.mapfile referencingpthreadlib, butwithout any actual use. If a curl dependency requires
pthreadand thedependency's CMake logic doesn't add it automatically, it needs to be
added manually to make it link in all cases, e.g. for BoringSSL with
mingw-w64, where it was already required for x64, but possibly worked
by accident for x86 and arm64.
Ref: curl/curl-for-win@74dd967#diff-98a81cf13297dad2803e548fe3ad9245cd8a732054f6ed89bff7360deaa3dff2R168-R170