diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-07-18 11:35:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-07-18 11:49:51 +0300 |
commit | 2199a3e38b1cf5956bd65e1d4ba38a3c50a4bed0 (patch) | |
tree | 5f929358b13aafdd63a4cd7d83b00f6ae4d5df22 /source | |
parent | 086ae3ea0401e9d6c39c31abc4a3ab96c285f1b6 (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 14 | ||||
-rw-r--r-- | source/blender/compositor/CMakeLists.txt | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 37e5b36779f..4f19c271d41 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -463,6 +463,20 @@ if(WITH_LIBMV) add_definitions(-DWITH_LIBMV) endif() +if(WITH_LIBMV_WERROR) + if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + set_source_files_properties(intern/tracking.c + intern/tracking_auto.c + intern/tracking_detect.c + intern/tracking_plane_tracker.c + intern/tracking_region_tracker.c + intern/tracking_solver.c + intern/tracking_stabilize.c + intern/tracking_util.c + PROPERTIES COMPILE_FLAGS -Werror) + endif() +endif() + if(WITH_FFTW3) list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS} diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 0d35d060f5f..7a8c5596a57 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -540,6 +540,12 @@ set(SRC list(APPEND INC ${CMAKE_CURRENT_BINARY_DIR}/operations ) + +if(WITH_COMPOSITOR_WERROR) + ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror) + ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror) +endif() + data_to_c(${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h SRC) |