]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: apply `WIN32_LEAN_AND_MEAN` to all feature checks
authorViktor Szakats <commit@vsz.me>
Thu, 10 Oct 2024 22:38:43 +0000 (00:38 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 11 Oct 2024 15:57:03 +0000 (17:57 +0200)
Enable `WIN32_LEAN_AND_MEAN` for all feature detections on Windows.

(Also drop it from individual detections.)

Cherry-picked from #15164

CMake/CurlTests.c
CMake/OtherTests.cmake
CMakeLists.txt

index 3fc3c86ba8845e4ac75c5f23a03d5dfae85ad8b1..03346187d6b050148d16886bdb1e4e1165891ff4 100644 (file)
@@ -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 <winsock2.h>
 #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 <winsock2.h>
 #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 <winsock2.h>
 #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 <winsock2.h>
 #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 <winsock2.h>
 #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
index f6ba407f696a51031c19033c855ed9cf847afdd1..736d539c87efad056f92b17ab832dc91348a959f 100644 (file)
@@ -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")
index 515e3ba88cd2037d0db3279524e5f3947558c224..80fa668c04fa24574390b0f417c18b0e6a7146b6 100644 (file)
@@ -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}")