From f6adbb022446c5c7d5813cb13bb5e993e12ef581 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 29 Mar 2014 17:16:13 +0100 Subject: [PATCH] Fix building with Qt5 on MSVC by undefining min/max macros The Windows stdlib.h header defines min/max macros, which interfer with the Qt5 header files. Luckily, it also provides the define NOMINMAX which suppresses these macros, and fix building. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f967fd..3033e600 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -447,6 +447,7 @@ endif(STATIC AND CMAKE_COMPILER_IS_GNUCXX) if(WIN32) link_libraries(imm32 winmm dbghelp Secur32) # missing by default :/ if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DNOMINMAX") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt") set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") -- 2.20.1