[cmake,c++] define NOMINMAX

Windows header define min and max posing issues with c++ standard
library
https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c
This commit is contained in:
akallabeth 2024-10-08 16:30:51 +02:00
parent fdd02c945a
commit 008de893fe

View File

@ -62,5 +62,10 @@ if (ENABLE_WARNING_ERROR)
CheckCXXFlag(-Werror)
endif()
# https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c
if (WIN32)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-DNOMINMAX>)
endif()
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "default CXXFLAGS")
message("Using CXXFLAGS ${CMAKE_CXX_FLAGS}")