From: Marc Hoersken Date: Thu, 1 Sep 2022 17:50:29 +0000 (+0200) Subject: cmake: skip superfluous hex2dec conversion using math expr X-Git-Tag: curl-7_86_0~301 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b66050eaeb6a8dc1c4076ebaaa4437eaba899e8;p=thirdparty%2Fcurl.git cmake: skip superfluous hex2dec conversion using math expr CMake seems to be able to compare two hex values just fine. Also make sure CURL_TARGET_WINDOWS_VERSION is respected. Assisted-by: Marcel Raad Reviewed-by: Viktor Szakats Reported-by: Keitagit-kun on github Follow up to #9312 Fixes #9406 Closes #9411 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cb597ca8ea..ba79d9ec74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ if(WIN32) if(CURL_TARGET_WINDOWS_VERSION) add_definitions(-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}) set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") + set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}") endif() if(ENABLE_UNICODE) add_definitions(-DUNICODE -D_UNICODE) @@ -1166,9 +1167,8 @@ if(WIN32) 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})") + string(REGEX REPLACE ".*_WIN32_WINNT=" "" HAVE_WIN32_WINNT "${OUTPUT}") + message(STATUS "Found _WIN32_WINNT=${HAVE_WIN32_WINNT}") endif() # avoid storing HAVE_WIN32_WINNT in CMake cache unset(HAVE_WIN32_WINNT CACHE)