1
0
mirror of synced 2024-11-24 07:40:17 +01:00

build: Added option to disable strict warnings

This commit is contained in:
WerWolv 2023-07-15 10:02:19 +02:00
parent 8500e4cba2
commit 0f54a3a1f3
3 changed files with 10 additions and 4 deletions

View File

@ -12,6 +12,7 @@ option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-por
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
option(IMHEX_ENABLE_LTO "Enables Link Time Optimizations if possible" OFF)
option(IMHEX_USE_DEFAULT_BUILD_SETTINGS "Use default build settings" OFF)
option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as errors" ON)
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)

View File

@ -377,8 +377,8 @@ function(verifyCompiler)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0.0")
message(FATAL_ERROR "ImHex requires GCC 12.0.0 or newer. Please use the latest GCC version.")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0.0")
message(FATAL_ERROR "ImHex requires Clang 14.0.0 or newer. Please use the latest Clang version.")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0.0")
message(FATAL_ERROR "ImHex requires Clang 17.0.0 or newer. Please use the latest Clang version.")
elseif (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
message(FATAL_ERROR "ImHex can only be compiled with GCC or Clang. ${CMAKE_CXX_COMPILER_ID} is not supported.")
endif()
@ -428,7 +428,10 @@ endfunction()
macro(setupCompilerFlags target)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Wpedantic -Werror")
if (IMHEX_STRICT_WARNINGS)
set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Wpedantic -Werror")
endif()
set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-array-bounds")
set(IMHEX_CXX_FLAGS "-fexceptions -frtti")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")

View File

@ -114,7 +114,9 @@ target_compile_definitions(libyara PRIVATE
HASH_MODULE DOTNET_MODULE MAGIC_MODULE MACHO_MODULE DEX_MODULE
)
target_compile_options(libyara PRIVATE -Wno-shift-count-overflow -Wno-stringop-overflow)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(libyara PRIVATE -Wno-shift-count-overflow -Wno-stringop-overflow)
endif ()
target_include_directories(
libyara