From 123a8decc26d659c1046aec223a83b69f3e6abef Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Thu, 23 Apr 2015 21:32:00 +0000 Subject: [PATCH] Define WIN32_LEAN_AND_MEAN and NOMINMAX for our own code only --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e25e97d3..dc568355b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,8 +118,6 @@ if(WIN32) set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DWINVER=0x0600 -D_WIN32_WINNT=0x0600") # Use Unicode API (although we always use W or A names explicitly) set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DUNICODE -D_UNICODE") - # Filter out needless definitions - set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DWIN32_LEAN_AND_MEAN -DNOMINMAX") # Ignore various deprecation and security warnings (at least for now) set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS") # Increase maximum FD_SET size @@ -317,6 +315,13 @@ endif() include_directories(${CMAKE_BINARY_DIR}) +if(WIN32) + foreach(L C CXX) + # Filter out needless definitions + set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -DWIN32_LEAN_AND_MEAN -DNOMINMAX") + endforeach() +endif() + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")