summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-11-07 14:17:51 +0000
committerJosé Fonseca <jfonseca@vmware.com>2014-11-08 10:21:29 +0000
commitd052e50c5e78eca69eb950671d943e2811d431fb (patch)
treefb319e3ec536e1d878d73ef27c6bb9e485d344b7 /CMakeLists.txt
parent09b4cef3663db5b34401ee3b48c6892ecbcf4d74 (diff)
cmake: Warn when variable length arrays are used.
As these are not supported on MSVC, not even MSVC 2013 since it only has library support for C99, it doesn't actually support C99 syntax. Suggested by Jan Vesely. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50e8cc86a..d1792d05f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,11 @@ if (NOT MSVC)
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" C_COMPILER_FLAG_WDECL_AFTER_STMT)
IF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeclaration-after-statement")
- ENDIF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
+ ENDIF ()
+ CHECK_C_COMPILER_FLAG("-Wvla" C_COMPILER_FLAG_WDECL_AFTER_STMT)
+ IF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
+ SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvla")
+ ENDIF ()
CHECK_CXX_COMPILER_FLAG("-Wno-narrowing" CXX_COMPILER_FLAG_WNO_NARROWING)
IF (CXX_COMPILER_FLAG_WNO_NARROWING)