diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index f7ff3b83f..01eeea1ae 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -412,8 +412,13 @@ function(downloadImHexPatternsFiles dest) endfunction() macro(setupCompilerWarnings target) - set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Wpedantic -Werror") - set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow -Wno-array-bounds -Wno-dangling-reference") + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + set(IMHEX_COMMON_FLAGS "-Wall -Wextra -Wpedantic -Werror") + set(IMHEX_C_FLAGS "${IMHEX_COMMON_FLAGS} -Wno-array-bounds") + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(IMHEX_C_FLAGS "${IMHEX_C_FLAGS} -Wno-restrict -Wno-stringop-overread -Wno-stringop-overflow -Wno-dangling-reference") + endif() + endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IMHEX_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IMHEX_C_FLAGS}")