From 40761fb545bfa31670b5d81ca323770ad9625f03 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sat, 16 Mar 2024 00:40:33 +0100 Subject: [PATCH] Fix warnings as errors for MSVC --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8437d265bc..8332db6151 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,8 +184,13 @@ if(OVERTE_WARNINGS_WHITELIST) endif() if(OVERTE_WARNINGS_AS_ERRORS) - set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror") - set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror") + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "" AND WIN32)) + set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} /WX") + set(ENV{CFLAGS} "$ENV{CXXFLAGS} /WX") + else() + set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror") + set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror") + endif() endif()