From 2199a3e38b1cf5956bd65e1d4ba38a3c50a4bed0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 18 Jul 2015 10:35:03 +0200 Subject: CMake: Add option to enable -Werror cflag in some areas It is rather annoying attitude nowadays to use const qualifier all over the place, including using it for multi-dimensional arrays. This isn't really supported in GCC prior to version 5.0 because it considers such an arrays to be a "pointer to a const pointer" which gives implicit casting errors. It's not possible to disable this particular type of warnings treated as errors in any GCC version prior to 5.0 as well, meaning currently usage of -Werror globally in Blender code is not possible at all. This commit makes it possible to use -Werror in areas which are complaint with older GCC versions. New advanced CMake options are: - WITH_COMPOSITOR_WERROR - WITH_LIBMV_WERROR - WITH_CYCLES_WERROR --- intern/cycles/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'intern/cycles/CMakeLists.txt') diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index acd6cd69329..c252a613cef 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -14,6 +14,11 @@ include(cmake/external_libs.cmake) # todo: refactor this code to match scons # note: CXX_HAS_SSE is needed in case passing SSE flags fails altogether (gcc-arm) +if(WITH_CYCLES_WERROR) + ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror) + ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror) +endif() + if(NOT WITH_CPU_SSE) set(CXX_HAS_SSE FALSE) set(CXX_HAS_AVX FALSE) -- cgit v1.2.3