if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
set(WERROR_COMMON_FLAGS "/WX")
else()
- check_c_compiler_flag(-Werror WERROR)
- if (WERROR)
- set(WERROR_COMMON_FLAGS "-Werror")
- endif()
-
#
- # Apple's llvm-gcc appears not to support suppressing
- # warnings with pragmas, so, if we're building on a Mac
- # (we check for APPLE), and we're not using Clang, we
- # suppress errors for some warnings that we can only
- # remove by suppressing them, as they're in generated
- # code.
+ # If a warning has been enabled by -Wall or -W,
+ # and have specified -Werror, there appears to be
+ # no way, in Apple's llvm-gcc, to prevent that
+ # particular warning from giving an error - not
+ # with a pragma, not with -Wno-{warning}, and not
+ # with -Wno-error={warning}.
#
- # We have to do this *after* -Werror, otherwise the
- # compiler decides -Werror means "never mind, make 'em
- # all errors.
+ # Therefore, with that compiler, we just disable
+ # -Werror.
#
- if (APPLE AND NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
- list(APPEND WERROR_COMMON_FLAGS
- -Wno-error=comma
- -Wno-error=shorten-64-to-32
- -Wno-error=unused-function
- )
+ if ((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+ check_c_compiler_flag(-Werror WERROR)
+ if (WERROR)
+ set(WERROR_COMMON_FLAGS "-Werror")
+ endif()
endif()
endif()
endif()