diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 600ac8e..fdc3b2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.1.0) project(smolbote) # Options +option(CompilerWarnings "Compiler warnings" ON) +option(QtDeprecatedWarnings "Qt deprecated warnings" ON) option(UseLibCpp "Use libc++ over stdlibc++ (requires clang)" OFF) option(CLikeConfig "Use a C-like style for the config" ON) @@ -20,7 +22,19 @@ set(CMAKE_AUTORCC ON) # Global C++ settings set(CMAKE_CXX_STANDARD 17) -add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900) + +if(CompilerWarnings) + if(CMAKE_COMPILER_IS_GNUCC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + endif() + if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() +endif(CompilerWarnings) + +if(QtDeprecatedWarnings) + add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900) +endif(QtDeprecatedWarnings) # link to libc++ if (UseLibCpp) |