mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-09-01 06:30:52 +02:00
add and use WarningsAsErrors cmake module
export cxx_std_20 with target_compile_features() but do not export pedantic Waning options!
This commit is contained in:
parent
c2751d904b
commit
c6c34b02d1
3 changed files with 20 additions and 12 deletions
|
@ -45,13 +45,16 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/
|
|||
# Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface
|
||||
# target: add_library(${PROJECT_NAME} INTERFACE)
|
||||
add_library(${PROJECT_NAME} ${headers} ${sources})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
||||
|
||||
# enable compiler warnings
|
||||
include(cmake/WarningsAsErrors.cmake)
|
||||
|
||||
# being a cross-platform target, we enforce standards conformance on MSVC
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")
|
||||
|
||||
# Link dependencies
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt)
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue