Enable C++11 and strict checks for all code, msvc compatibility.

This commit is contained in:
Stefano Sanfilippo 2019-07-07 10:06:50 +02:00
parent 25110521d0
commit 21f27ec261
3 changed files with 11 additions and 5 deletions

View File

@ -12,6 +12,12 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
include(CPack)
include(Doxycelli)
if (MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()
add_subdirectory(src)
install(FILES README.md LICENSE.txt DESTINATION doc/monicelli)

View File

@ -29,8 +29,10 @@ function(add_ragel_library name ragel_source)
CXX_STANDARD_REQUIRED true
)
if (NOT MSVC)
# The lexer uses implicit fallthroughs all over, but it's OK.
target_compile_options(${name} PRIVATE -Wno-implicit-fallthrough)
endif()
target_include_directories(${name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
endfunction()

View File

@ -33,14 +33,12 @@ add_executable(mcc
operators.def
)
set_target_properties(mcc
set_target_properties(mcc lexer
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED true
)
target_compile_options(mcc PRIVATE -Wall -Wextra -Werror)
target_link_libraries(mcc PRIVATE lexer)
llvm_config(mcc