diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2022-08-14 19:05:40 +0000 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2022-08-26 21:09:32 +0200 |
commit | 109e9730ee5e2b7445c37798ac3f50aa11133831 (patch) | |
tree | d13d8a3d550b4a93a9c8673ef8c8ea7760103270 /CMakeLists.txt | |
parent | 8c98d14b88b73d0b10c8be453c5970e9ecde4bba (diff) | |
download | curl-109e9730ee5e2b7445c37798ac3f50aa11133831.tar.gz |
cmake: add detection of threadsafe feature
Avoids failing test 1014 by replicating configure checks
for HAVE_ATOMIC and _WIN32_WINNT with custom CMake tests.
Reviewed-by: Marcel Raad
Follow up to #8680
Closes #9312
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a0a8558..fd7b01e87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -982,6 +982,7 @@ check_include_file_concat("pwd.h" HAVE_PWD_H) check_include_file_concat("setjmp.h" HAVE_SETJMP_H) check_include_file_concat("signal.h" HAVE_SIGNAL_H) check_include_file_concat("ssl.h" HAVE_SSL_H) +check_include_file_concat("stdatomic.h" HAVE_STDATOMIC_H) check_include_file_concat("stdbool.h" HAVE_STDBOOL_H) check_include_file_concat("stdint.h" HAVE_STDINT_H) check_include_file_concat("stdlib.h" HAVE_STDLIB_H) @@ -1143,6 +1144,7 @@ foreach(CURL_TEST HAVE_FILE_OFFSET_BITS HAVE_VARIADIC_MACROS_C99 HAVE_VARIADIC_MACROS_GCC + HAVE_ATOMIC ) curl_internal_test(${CURL_TEST}) endforeach() @@ -1159,6 +1161,19 @@ set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h") check_type_size("curl_off_t" SIZEOF_CURL_OFF_T) set(CMAKE_EXTRA_INCLUDE_FILES "") +if(WIN32) + # detect actual value of _WIN32_WINNT and store as HAVE_WIN32_WINNT + curl_internal_test(HAVE_WIN32_WINNT) + if(HAVE_WIN32_WINNT) + string(REGEX MATCH ".*_WIN32_WINNT=0x[0-9a-fA-F]+" OUTPUT "${OUTPUT}") + string(REGEX REPLACE ".*_WIN32_WINNT=" "" OUTPUT "${OUTPUT}") + math(EXPR HAVE_WIN32_WINNT "${OUTPUT}" OUTPUT_FORMAT DECIMAL) + message(STATUS "Found _WIN32_WINNT=${OUTPUT} (${HAVE_WIN32_WINNT})") + endif() + # avoid storing HAVE_WIN32_WINNT in CMake cache + unset(HAVE_WIN32_WINNT CACHE) +endif() + set(CMAKE_REQUIRED_FLAGS) foreach(CURL_TEST @@ -1417,6 +1432,8 @@ _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE) _add_if("MultiSSL" CURL_WITH_MULTI_SSL) _add_if("HTTPS-proxy" SSL_ENABLED AND (USE_OPENSSL OR USE_GNUTLS OR USE_NSS)) _add_if("unicode" ENABLE_UNICODE) +_add_if("threadsafe" HAVE_ATOMIC OR (WIN32 AND + HAVE_WIN32_WINNT GREATER_EQUAL 0x600)) string(REPLACE ";" " " SUPPORT_FEATURES "${_items}") message(STATUS "Enabled features: ${SUPPORT_FEATURES}") |