From: Viktor Szakats Date: Thu, 10 Oct 2024 22:38:43 +0000 (+0200) Subject: cmake: apply `WIN32_LEAN_AND_MEAN` to all feature checks X-Git-Tag: curl-8_11_0~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfd36d3ee0702ccd7cd2b784db21d8e88483af74;p=thirdparty%2Fcurl.git cmake: apply `WIN32_LEAN_AND_MEAN` to all feature checks Enable `WIN32_LEAN_AND_MEAN` for all feature detections on Windows. (Also drop it from individual detections.) Cherry-picked from #15164 --- diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c index 3fc3c86ba8..03346187d6 100644 --- a/CMake/CurlTests.c +++ b/CMake/CurlTests.c @@ -166,9 +166,6 @@ int main(void) { return 0; } #ifdef HAVE_IOCTLSOCKET /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # include #endif int main(void) @@ -185,9 +182,6 @@ int main(void) #ifdef HAVE_IOCTLSOCKET_CAMEL /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # include #endif int main(void) @@ -203,9 +197,6 @@ int main(void) #ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # include #endif int main(void) @@ -222,9 +213,6 @@ int main(void) #ifdef HAVE_IOCTLSOCKET_FIONBIO /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # include #endif int main(void) @@ -297,9 +285,6 @@ int main(void) #ifdef HAVE_SETSOCKOPT_SO_NONBLOCK /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # include #endif /* includes start */ @@ -410,9 +395,6 @@ int main(void) #ifdef HAVE_WIN32_WINNT /* includes start */ #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif # ifndef NOGDI # define NOGDI # endif diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake index f6ba407f69..736d539c87 100644 --- a/CMake/OtherTests.cmake +++ b/CMake/OtherTests.cmake @@ -39,7 +39,6 @@ if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE) unset(CMAKE_EXTRA_INCLUDE_FILES) if(WIN32) set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h") - set(CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN") set(CMAKE_REQUIRED_LIBRARIES "ws2_32") elseif(HAVE_SYS_SOCKET_H) set(CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h") diff --git a/CMakeLists.txt b/CMakeLists.txt index 515e3ba88c..80fa668c04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,8 @@ if(WIN32) endif() endif() + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DWIN32_LEAN_AND_MEAN") # Apply to all feature checks + set(CURL_TARGET_WINDOWS_VERSION "" CACHE STRING "Minimum target Windows version as hex string") if(CURL_TARGET_WINDOWS_VERSION) add_definitions("-D_WIN32_WINNT=${CURL_TARGET_WINDOWS_VERSION}")