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.
if (STRICT_COMPILATION_CHECKS)
add_flags(STRICT_FLAGS
-Werror
if (STRICT_COMPILATION_CHECKS)
add_flags(STRICT_FLAGS
-Werror
# NOTE: Vanilla libusb-1.0.8 can't live with -pedantic-errors
-pedantic-errors)
# NOTE: Vanilla libusb-1.0.8 can't live with -pedantic-errors
-pedantic-errors)
+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}")
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}")