From: Antonio Ospite Date: Sat, 13 Jul 2013 09:05:00 +0000 (+0200) Subject: CMakeLists.txt: enable two new compiler warnings X-Git-Tag: v0.1.4~22 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/7d098152afd41bf21d3815af58293f6ea58d296e?hp=f641ad3eaaada89be7816332f2804dad9d9ecd39 CMakeLists.txt: enable two new compiler warnings Enable -Wsign-conversion as a strict compilation check for both gcc and clang. For clang also enable -Wshorten-64-to-32 as a strict compilation check. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d908f1c..49c3ac0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,6 +78,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) if (STRICT_COMPILATION_CHECKS) add_flags(STRICT_FLAGS -Werror + -Wsign-conversion # NOTE: Vanilla libusb-1.0.8 can't live with -pedantic-errors -pedantic-errors) @@ -96,6 +97,13 @@ if (CMAKE_COMPILER_IS_GNUCC) endif() endif() +if (CMAKE_COMPILER_IS_CLANG) + if (STRICT_COMPILATION_CHECKS) + add_flags(STRICT_FLAGS + -Wshorten-64-to-32) + endif() +endif() + set(CMAKE_C_FLAGS_DEBUG "-O0 ${DEBUG_FLAGS} ${STRICT_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-O2 ${RELEASE_FLAGS} ${STRICT_FLAGS}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 ${RELEASE_FLAGS} ${DEBUG_FLAGS} ${STRICT_FLAGS}")