From c536caaf132f16ce849f6190a796f6aea89422aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 3 Sep 2019 11:30:24 +0200 Subject: [PATCH] CMake: avoid /W3 overriding warnings and enable -DUNICODE on Windows. Consistent with how all other Magnum projects do it. --- src/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b3ec6c5..07ec013 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,6 +23,17 @@ # DEALINGS IN THE SOFTWARE. # +# On MSVC remove /W3, as we are replacing it with /W4 +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") + string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endif() + +# On Windows enable UNICODE/_UNICODE macros to avoid accidentally passing UTF-8 +# values to ANSI functions +if(CORRADE_TARGET_WINDOWS) + add_definitions("-DUNICODE" "-D_UNICODE") +endif() + set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) add_subdirectory(Corrade)