Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorKrzesimir Nowak <krzesimir@endocode.com>2013-08-07 14:36:45 +0400
committerKrzesimir Nowak <krzesimir@endocode.com>2013-08-07 14:54:34 +0400
commit114f66f2972b06ae4f2c7080b63836c1874a30b1 (patch)
tree014bd102fd5c26b4850f917730c7839be9c5272e /cmake
parentf8878833defcd6fa920bebf4c3e1cd590b7418e0 (diff)
Add -Wall -Wextra -Wpedantic (or -pedantic) warnings by default.
This also introduces a MIRALL_FATAL_WARNINGS to enable a -Werror for GNU compilers and clang. MSVC compilers are yet to be handled.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/Warnings.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/modules/Warnings.cmake b/cmake/modules/Warnings.cmake
new file mode 100644
index 000000000..6ba251349
--- /dev/null
+++ b/cmake/modules/Warnings.cmake
@@ -0,0 +1,20 @@
+if(CMAKE_COMPILER_IS_GNUCXX)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
+ OUTPUT_VARIABLE GCC_VERSION)
+ if(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic")
+ else(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
+ endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
+endif(CMAKE_COMPILER_IS_GNUCXX)
+if(CMAKE_CXX_COMPILER MATCHES "clang")
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
+endif(CMAKE_CXX_COMPILER MATCHES "clang")
+# TODO: handle msvc compilers warnings?
+
+if(DEFINED MIRALL_FATAL_WARNINGS)
+ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER MATCHES "clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+ endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER MATCHES "clang")
+ # TODO: handle msvc compilers warnings?
+endif(DEFINED MIRALL_FATAL_WARNINGS)