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
This commit is contained in:
Viktor Szakats 2024-10-11 00:38:43 +02:00
parent 8e34505776
commit dfd36d3ee0
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
3 changed files with 2 additions and 19 deletions

View 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")