From f88a971dd3d954fc15044558ce12c5eb4ac6d6c7 Mon Sep 17 00:00:00 2001 From: Holden Date: Wed, 1 Jan 2025 03:25:29 -0500 Subject: [PATCH] CMake: Turn On Warnings as Errors --- CMakeLists.txt | 9 ++++++++- src/AnalyzeView/CMakeLists.txt | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d50e8750eda..9a96960e716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22.1) +cmake_minimum_required(VERSION 3.24) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake @@ -64,6 +64,7 @@ set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_COMPILE_WARNING_AS_ERROR ON) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release") if(NOT CMAKE_BUILD_TYPE) @@ -110,6 +111,12 @@ endif() set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) +if (MSVC) + add_compile_options(/W4) +else() + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + ####################################################### # Qt6 Configuration ####################################################### diff --git a/src/AnalyzeView/CMakeLists.txt b/src/AnalyzeView/CMakeLists.txt index 156a21bdbb5..c172cd1305c 100644 --- a/src/AnalyzeView/CMakeLists.txt +++ b/src/AnalyzeView/CMakeLists.txt @@ -65,6 +65,8 @@ endif() #===========================================================================# +set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) + set(MINIMUM_EXIV2_VERSION 0.28.2) if(NOT QGC_BUILD_DEPENDENCIES) @@ -139,6 +141,8 @@ endif() target_sources(AnalyzeView PRIVATE ExifParser.cc ExifParser.h) +set(CMAKE_COMPILE_WARNING_AS_ERROR ON) + #===========================================================================# # qt_add_qml_module(AnalyzeView