From ce5699ce6024d5f285e10611f92530105392e3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 19 Feb 2017 22:34:29 +0100 Subject: [PATCH] CMake: define UNICODE/_UNICODE on Windows to prevent ANSI accidents. --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f4ece4669..5a07f494e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,6 +41,12 @@ if(CORRADE_TARGET_EMSCRIPTEN AND NOT TARGET_GLES2) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") 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_CXX_STANDARD 11 CORRADE_USE_PEDANTIC_FLAGS ON)