Merge pull request #46 from mrexodia/minmax

Fix ::min and ::max usage on Windows
This commit is contained in:
Can Bölük 2020-10-26 10:28:58 +01:00 committed by GitHub
commit b1009befe4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)