Require C++17 and force MSVC to treat source as UTF-8

Co-authored-by: Mikael Olenfalk <mikael@olenfalk.se>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Mikael Olenfalk 2020-03-21 16:13:14 +01:00 committed by ArthurSonzogni
parent 9ca8d41afc
commit a1c390ea31

View File

@ -74,11 +74,27 @@ foreach(lib screen dom component)
PRIVATE PRIVATE
src src
) )
# C++17 is used. We requires fold expression at least.
set_property(TARGET ${lib} PROPERTY CXX_STANDARD 17) set_property(TARGET ${lib} PROPERTY CXX_STANDARD 17)
target_compile_options(${lib} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX> # Force Microsoft Visual Studio to decode sources files in UTF-8. This applies
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -pedantic -Werror -Wno-sign-compare> # to the library and the library users.
) if (MSVC)
target_compile_options(${lib} PUBLIC "/utf-8>")
endif()
# Add as many warning as possible:
if (MSVC)
target_compile_options(${lib} PRIVATE "/W4")
target_compile_options(${lib} PRIVATE "/WX")
else()
target_compile_options(${lib} PRIVATE "-Wall")
target_compile_options(${lib} PRIVATE "-Wextra")
target_compile_options(${lib} PRIVATE "-pedantic")
target_compile_options(${lib} PRIVATE "-Werror")
target_compile_options(${lib} PRIVATE "-Wno-sign-compare")
endif()
endforeach() endforeach()
if(FTXUI_ENABLE_INSTALL) if(FTXUI_ENABLE_INSTALL)