Enable strict compile flags

This commit is contained in:
ItsDrike 2024-12-05 02:34:42 +01:00
parent 3facc3333c
commit a9a9c6fd9e
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -54,3 +54,16 @@ install(TARGETS appSolitare
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# Enable strict compile flags for warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(appSolitare PRIVATE
# Enable high-level warnings
-Wall -Wextra -pedantic
# Enable warnings as errors
-Werror
)
elseif(MSVC)
# For MSVC, use /W4 for strict warnings and /WX to treat warnings as errors
target_compile_options(appSolitare PRIVATE /W4 /WX)
endif()