# Compiler warnings configuration function(set_project_warnings) option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON) if(MSVC) add_compile_options( /W4 /permissive- /std:c++20 # Explicitly enable C++20 standard $<$:/WX> # Disable specific warnings that are too strict /wd4244 # conversion from 'int' to 'char', possible loss of data /wd4996 # 'fopen': This function or variable may be unsafe ) else() add_compile_options( -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion $<$:-Werror> ) endif() endfunction() # Function to disable specific warnings for third-party libraries function(disable_third_party_warnings target) if(NOT MSVC) target_compile_options(${target} PRIVATE -Wno-sign-conversion -Wno-conversion ) endif() endfunction()