From 0c05dcc51b76ca10b885c7a44f743b8cfbc51b04 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Fri, 23 Oct 2020 13:31:08 +0200 Subject: [PATCH] Fix ::min and ::max usage on Windows utils/numeric_iterator crashes MSVC without it --- VTIL-Common/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/VTIL-Common/CMakeLists.txt b/VTIL-Common/CMakeLists.txt index eb54edb..b4e6b28 100644 --- a/VTIL-Common/CMakeLists.txt +++ b/VTIL-Common/CMakeLists.txt @@ -22,6 +22,11 @@ target_link_libraries(${PROJECT_NAME} PUBLIC capstone-static keystone) # https://cmake.org/cmake/help/v3.14/manual/cmake-compile-features.7.html#requiring-language-standards target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) +# Make sure ::min/max does not resolve to a Windows.h macro +if(WIN32) + target_compile_definitions(${PROJECT_NAME} PUBLIC WIN32_LEAN_AND_MEAN NOMINMAX) +endif() + # For portability on non-MSVC compilers, add some compile options if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") target_compile_options(${PROJECT_NAME} PUBLIC -Wno-narrowing)