mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-12 22:53:27 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user