From 8dc63ba941e80a9fc515c28d5bb9ae0bbd5acc07 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 25 May 2017 01:05:49 -0400 Subject: [PATCH] Force MSVC to compile in utf-8 mode MSVC by default uses the local codepage, which fails when it sees the utf-8 in test_python_types.cpp. This adds the /utf-8 flag to the test suite compilation to force it to interpret source code as utf-8. Fixes #869 --- tests/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36988c36..2c2437f2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -128,6 +128,10 @@ pybind11_add_module(pybind11_tests THIN_LTO pybind11_tests.cpp pybind11_enable_warnings(pybind11_tests) +if(MSVC) + target_compile_options(pybind11_tests PRIVATE /utf-8) +endif() + if(EIGEN3_FOUND) if (PYBIND11_EIGEN_VIA_TARGET) target_link_libraries(pybind11_tests PRIVATE Eigen3::Eigen)