# Reusable warning configuration. # Usage: pdfengine_set_warnings( [PRIVATE|INTERFACE|PUBLIC]) function(pdfengine_set_warnings target) set(_scope PRIVATE) if(ARGV1) set(_scope ${ARGV1}) endif() set(_msvc_warnings /W4 /permissive- # strict standard conformance /w14242 /w14254 /w14263 /w14265 /w14287 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14619 /w14640 /w14826 /w14905 /w14906 /w14928 /EHsc ) set(_gnu_clang_warnings -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor -Wcast-align -Wunused -Woverloaded-virtual -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough ) if(MSVC) set(_warnings ${_msvc_warnings}) else() set(_warnings ${_gnu_clang_warnings}) endif() if(PDFENGINE_WARNINGS_AS_ERRORS) if(MSVC) list(APPEND _warnings /WX) else() list(APPEND _warnings -Werror) endif() endif() target_compile_options(${target} ${_scope} ${_warnings}) endfunction()