diff options
author | Robert Adam <dev@robert-adam.de> | 2021-05-13 20:46:38 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2021-05-13 20:46:38 +0300 |
commit | 7fb4708c03a204cec977624828bc4b69356301a9 (patch) | |
tree | 118e4d5d0652006aeb6b0c682f6bfefd2a20c02e /cmake | |
parent | c54a7dfbd9682e4c0412c16baca921f2f5bda0db (diff) |
BUILD(cmake, windows): Prevent definition min/max macros
These macros are defined in Windows.h if the NOMINMAX macro is not set.
This then causes all other uses of the terms "min" and "max" (as e.g. in
std::min, std::numeric_limits<>::min, etc.) to fail, which is
unacceptable. Therefore NOMINMAX is now defined globally when compiling
on Windows.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/os.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmake/os.cmake b/cmake/os.cmake index 46b46abe0..78ccfb8bf 100644 --- a/cmake/os.cmake +++ b/cmake/os.cmake @@ -32,6 +32,8 @@ if(WIN32) add_definitions( "-DUNICODE" "-DWIN32_LEAN_AND_MEAN" + # Prevent Windows headers from defining the macros "min" and "max" that mess up e.g. std::min usage + "-DNOMINMAX" ) else() if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") |