Skip to content

Commit

Permalink
Add MSVC option for consistently using UTF-8
Browse files Browse the repository at this point in the history
Add MSVC option for consistently using UTF-8 instead of environment specific code pages
  • Loading branch information
brondani authored Aug 31, 2022
1 parent 3c41210 commit f02ce6f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ if(NOT CMAKE_BUILD_TYPE)
endif()

if(MSVC)
#disable C4996 warning: of not using *_s functions
# disable C4996 warning: of not using *_s functions
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI /Gy /FC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI /Gy /FC /utf-8")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /utf-8")
# disable optimization for RelWithDebug
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zi /Od")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zi /Od /utf-8")
add_link_options("$<$<CONFIG:Debug>:/SAFESEH:NO>")
endif(MSVC)

Expand Down

0 comments on commit f02ce6f

Please sign in to comment.