function(course_apply_warnings target_name) if(MSVC) target_compile_options(${target_name} PRIVATE /W4 /permissive-) if(COURSE_WARNINGS_AS_ERRORS) target_compile_options(${target_name} PRIVATE /WX) endif() else() target_compile_options( ${target_name} PRIVATE -Wall -Wextra -Wpedantic -Wconversion -Wshadow ) if(COURSE_WARNINGS_AS_ERRORS) target_compile_options(${target_name} PRIVATE -Werror) endif() endif() endfunction() function(course_set_cxx_standard target_name standard) target_compile_features(${target_name} PRIVATE cxx_std_${standard}) endfunction() function(course_enable_contracts target_name) if(NOT COURSE_ENABLE_CONTRACTS) return() endif() if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)) return() endif() target_compile_options( ${target_name} PRIVATE -fcontracts -fcontract-evaluation-semantic=enforce ) target_link_options(${target_name} PRIVATE -fcontracts) target_link_libraries(${target_name} PRIVATE course_contract_support) endfunction()