Define WIN32_LEAN_AND_MEAN in the build system, not in the code.

This avoids a conflict with the Chromium build system, which
defines WIN32_LEAN_AND_MEAN with a different value.

BUG=crbug.com/453196

Change-Id: Ia15ec7c20325c1961af4f32e5208266e5f846f35
Reviewed-on: https://boringssl-review.googlesource.com/3150
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b67c617..7451c4b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@
   set(CMAKE_C_FLAGS "/wd4267")
   set(CMAKE_CXX_FLAGS "/wd4267")
   add_definitions(-D_HAS_EXCEPTIONS=0)
+  add_definitions(-DWIN32_LEAN_AND_MEAN)
 endif()
 
 if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.5.99") OR
diff --git a/crypto/bio/bio_test.c b/crypto/bio/bio_test.c
index 57684df..db6fc02 100644
--- a/crypto/bio/bio_test.c
+++ b/crypto/bio/bio_test.c
@@ -26,7 +26,6 @@
 #include <sys/socket.h>
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN
 #include <io.h>
 #include <WinSock2.h>
 #include <WS2tcpip.h>
diff --git a/crypto/bio/connect.c b/crypto/bio/connect.c
index 55b9352..8068b3d 100644
--- a/crypto/bio/connect.c
+++ b/crypto/bio/connect.c
@@ -66,7 +66,6 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN
 #include <WinSock2.h>
 #include <WS2tcpip.h>
 #endif
diff --git a/crypto/bio/fd.c b/crypto/bio/fd.c
index c5133d8..bc47e74 100644
--- a/crypto/bio/fd.c
+++ b/crypto/bio/fd.c
@@ -61,7 +61,6 @@
 #if !defined(OPENSSL_WINDOWS)
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN
 #include <io.h>
 #include <Windows.h>
 #endif
diff --git a/crypto/bio/socket.c b/crypto/bio/socket.c
index 6d393a2..aeaedf2 100644
--- a/crypto/bio/socket.c
+++ b/crypto/bio/socket.c
@@ -62,7 +62,6 @@
 #if !defined(OPENSSL_WINDOWS)
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN
 #include <WinSock2.h>
 #endif
 
diff --git a/crypto/bio/socket_helper.c b/crypto/bio/socket_helper.c
index 801800a..7fd15e6 100644
--- a/crypto/bio/socket_helper.c
+++ b/crypto/bio/socket_helper.c
@@ -24,7 +24,6 @@
 #include <netdb.h>
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN
 #include <WinSock2.h>
 #include <WS2tcpip.h>
 #endif
diff --git a/crypto/directory_win.c b/crypto/directory_win.c
index 203d4a2..4956383 100644
--- a/crypto/directory_win.c
+++ b/crypto/directory_win.c
@@ -30,7 +30,6 @@
 
 #if defined(OPENSSL_WINDOWS)
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <tchar.h>
 #include <errno.h>
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 5ee81ca..892b2ac 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -115,7 +115,6 @@
 #include <stdio.h>
 
 #if defined(OPENSSL_WINDOWS)
-#define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
 #endif
 
diff --git a/crypto/mem.c b/crypto/mem.c
index 8341411..11ef335 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -65,7 +65,6 @@
 #include <string.h>
 
 #if defined(OPENSSL_WINDOWS)
-#define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
 #else
 #include <strings.h>
diff --git a/crypto/rand/windows.c b/crypto/rand/windows.c
index 86bea85..ed6e5e9 100644
--- a/crypto/rand/windows.c
+++ b/crypto/rand/windows.c
@@ -16,7 +16,6 @@
 
 #if defined(OPENSSL_WINDOWS)
 
-#define WIN32_LEAN_AND_MEAN
 #include <limits.h>
 #include <stdlib.h>
 #include <Windows.h>
diff --git a/crypto/thread.c b/crypto/thread.c
index b1b4d00..15e38bd 100644
--- a/crypto/thread.c
+++ b/crypto/thread.c
@@ -59,7 +59,6 @@
 #include <errno.h>
 
 #if defined(OPENSSL_WINDOWS)
-#define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
 #endif
 
diff --git a/tool/digest.cc b/tool/digest.cc
index 086d3a4..f7ecda0 100644
--- a/tool/digest.cc
+++ b/tool/digest.cc
@@ -32,7 +32,6 @@
 #endif
 #else
 #define NOMINMAX
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <io.h>
 #define PATH_MAX MAX_PATH
diff --git a/tool/speed.cc b/tool/speed.cc
index 8184339e..cfffcb0 100644
--- a/tool/speed.cc
+++ b/tool/speed.cc
@@ -27,7 +27,6 @@
 #include <openssl/rsa.h>
 
 #if defined(OPENSSL_WINDOWS)
-#define WIN32_LEAN_AND_MEAN
 #include <Windows.h>
 #elif defined(OPENSSL_APPLE)
 #include <sys/time.h>
diff --git a/tool/transport_common.cc b/tool/transport_common.cc
index 00b4a8b..0f48703 100644
--- a/tool/transport_common.cc
+++ b/tool/transport_common.cc
@@ -30,7 +30,6 @@
 #include <sys/socket.h>
 #include <unistd.h>
 #else
-#define WIN32_LEAN_AND_MEAN // prevent conflicting defines of X509_* names
 #define NOMINMAX
 #include <io.h>
 #include <WinSock2.h>