summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-11-13 19:31:23 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-11-13 19:31:23 (GMT)
commitd3fb1fa6f016b107a2051aa0b92defe79652e941 (patch)
treeadb4cfbb6f87d3dd9fd209697826f48a486d78c4
parent70b176e276e874b78562519b48fa2cee6e05cd6b (diff)
parentd06a9bdf3ab47231cc91b78dac77bd50de390565 (diff)
downloadCMake-d3fb1fa6f016b107a2051aa0b92defe79652e941.zip
CMake-d3fb1fa6f016b107a2051aa0b92defe79652e941.tar.gz
CMake-d3fb1fa6f016b107a2051aa0b92defe79652e941.tar.bz2
Merge topic 'compiler-warnings'
d06a9bd Enable some compiler warnings when building CMake.
-rw-r--r--CMakeLists.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea1c033..a67fb6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -585,6 +585,29 @@ option(CMAKE_STRICT
"Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
mark_as_advanced(CMAKE_STRICT)
+if(NOT CMake_VERSION_IS_RELEASE)
+ if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
+ NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
+ set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
+ -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
+ -Wmissing-format-attribute -fno-common
+ )
+ set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
+ -Wshadow -Wpointer-arith -Wformat-security
+ )
+
+ foreach(FLAG_LANG C CXX)
+ foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
+ if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
+ set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
+ endif()
+ endforeach()
+ endforeach()
+
+ unset(C_FLAGS_LIST)
+ unset(CXX_FLAGS_LIST)
+ endif()
+endif()
# build the remaining subdirectories
add_subdirectory(Source)