From 2c9f10ab4458af452c353d3ea9c68d86e2e8507e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 7 Nov 2014 09:44:43 -0800 Subject: Fixed compiler warnings in cmake. --- src/CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/CMakeLists.txt') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad94587..69c387e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,4 +70,16 @@ if(UNIX) endif(UNIX) include (CheckIncludeFile) -CHECK_INCLUDE_FILE (stdbool.h HAVE_STDBOOL_H) \ No newline at end of file +CHECK_INCLUDE_FILE (stdbool.h HAVE_STDBOOL_H) + +# Always compile with warnings +if(MSVC) + # Force to always compile with W4 + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + endif() +elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99") +endif() -- cgit v1.2.3