summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-07 09:44:43 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-07 09:49:14 -0800
commit2c9f10ab4458af452c353d3ea9c68d86e2e8507e (patch)
treee2af1359787856bd81b631a0b55e514b4ef81b67
parent6b2193f804b3412eef476a834a7627d5a10da439 (diff)
Fixed compiler warnings in cmake.
-rw-r--r--CMakeLists.txt12
-rw-r--r--src/CMakeLists.txt14
2 files changed, 13 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c42ee90..42d2382 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,18 +16,6 @@ add_subdirectory(src)
set(CMAKE_BUILD_TYPE Release)
-if(MSVC)
- # Force to always compile with W4
- if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
- string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
- endif()
-elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
- # Update if necessary
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
-endif()
-
#option(${PROJECT_NAME}_WITH_DOCS "generate Documentation" OFF)
#option(${PROJECT_NAME}_WITH_TESTS "enable testing" ON)
option(CMAKE_SUPPRESS_REGENERATION "suppress rules to re-run cmake on changes (warning: no dependency checks!)?" OFF)
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()