From a9a9c6fd9e43e935ee1dcaa420fddfa11dc28a0c Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 5 Dec 2024 02:34:42 +0100 Subject: [PATCH] Enable strict compile flags --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac02ea1..ae074c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()