Skip to content

Commit

Permalink
Force Visual C++ to treat source files as UTF-8.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtl1979 authored and Dead2 committed Sep 25, 2024
1 parent a689e10 commit 13d0a89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,16 @@ if(NOT WITH_CODE_COVERAGE AND NOT MSVC AND NOT CMAKE_C_FLAGS MATCHES "([\\/\\-]O
CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()

# Force Visual C++ to use UTF-8
if(MSVC)
if (NOT CMAKE_C_FLAGS MATCHES "[\\/\\-]utf-8")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
endif()
if (NOT CMAKE_CXX_FLAGS MATCHES "[\\/\\-]utf-8")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif()
endif()

#
# Check for standard/system includes
#
Expand Down
5 changes: 1 addition & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,7 @@ if(WITH_GTEST)
configure_test_executable(gtest_zlib)

if(MSVC)
target_compile_options(gtest_zlib PRIVATE /wd4389)
if(BASEARCH_ARM_FOUND)
target_compile_options(gtest_zlib PRIVATE /EHsc)
endif()
target_compile_options(gtest_zlib PRIVATE /wd4389 /EHsc)
endif()

if(WITH_SANITIZER STREQUAL "Memory")
Expand Down

0 comments on commit 13d0a89

Please sign in to comment.