Fixes MSVC redefinition of min/max

Adds a compiler definition for MSVC to prevent redefinition of min/max macros by the Windows SDK.

Removes unnecessary undef directives in color.hpp as the NOMINMAX definition now handles the issue.
This commit is contained in:
2025-08-21 00:17:59 +03:00
parent 2d9ed4cfc8
commit 625c676010
3 changed files with 9 additions and 12 deletions

View File

@@ -102,6 +102,11 @@ elseif (OMATH_THREAT_WARNING_AS_ERROR)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif ()
# Windows SDK redefine min/max via preprocessor and break std::min and std::max
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(${PROJECT_NAME} INTERFACE NOMINMAX)
endif ()
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> # Use this path when building the project