Files
pokemon-battle-engine/cmake/modules/CompilerWarnings.cmake
cdemeyer-teachx ee337f001a codebase refactor
2025-08-15 12:38:44 +09:00

33 lines
820 B
CMake

# Compiler warnings configuration
function(set_project_warnings)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
if(MSVC)
add_compile_options(
/W4
/permissive-
$<$<BOOL:${WARNINGS_AS_ERRORS}>:/WX>
)
else()
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Wshadow
-Wconversion
-Wsign-conversion
$<$<BOOL:${WARNINGS_AS_ERRORS}>:-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()