summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-04-13 18:06:43 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-04-13 18:08:47 +0200
commit4f8b17e67a99623037228b398e5e1d2a82ab8b5a (patch)
tree291e0b64b60cd42f1aed8b9ab66bd9ecae0c9291
parent48d353a5cb22e596f12946ef7202e9946679e2c8 (diff)
downloadlogdiag-4f8b17e67a99623037228b398e5e1d2a82ab8b5a.tar.gz
logdiag-4f8b17e67a99623037228b398e5e1d2a82ab8b5a.tar.xz
logdiag-4f8b17e67a99623037228b398e5e1d2a82ab8b5a.zip
Add support for style checking using vera++.
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt35
m---------vera++0
3 files changed, 38 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..40e3a29
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "vera++"]
+ path = vera++
+ url = https://bitbucket.org/ThArGos/vera.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 931255b..015b326 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ cmake_minimum_required (VERSION 2.6.2)
cmake_policy (VERSION 2.6.3)
# Options
+option (OPTION_USE_VERA "Use vera++ for source code style checks" OFF)
option (OPTION_NOINSTALL "Only for developers; work without installing" OFF)
if (OPTION_NOINSTALL)
@@ -271,6 +272,40 @@ find_package (CppCheck)
GENERATE_CPPCHECK (SOURCES liblogdiag src tests ENABLE_IDS all
TARGET_NAME ${CMAKE_PROJECT_NAME}_cppcheck INCLUDES ${CMAKE_CURRENT_BINARY_DIR})
+if (OPTION_USE_VERA)
+ # Make it build within the same build tree
+ get_directory_property (backup_includes INCLUDE_DIRECTORIES)
+ set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES "")
+ set (backup_source_dir "${CMAKE_SOURCE_DIR}")
+ set (CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/vera++")
+
+ add_subdirectory ("vera++")
+
+ set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES "${backup_includes}")
+ set (CMAKE_SOURCE_DIR "${backup_source_dir}")
+
+ # Check the sources
+ # XXX: maybe do it per source file and not all at once
+ set (vera_srcs ${liblogdiag_SOURCES} ${logdiag_SOURCES} ${logdiag_HEADERS})
+ set (vera_output ${CMAKE_CURRENT_BINARY_DIR}/vera.log)
+ add_custom_command (OUTPUT ${vera_output}
+ COMMAND vera++
+ -R F001 -R L001 -R T001 -R T004 -R T005 -R T006
+ -R T007 -R T009 -R T010 -R T015 -R T017 -R T018
+ -R L004 -P max-line-length=80
+ -R L005 -P max-consecutive-empty-lines=2
+ --root ${CMAKE_SOURCE_DIR}/vera++
+ --std-report=-
+ --std-report=${vera_output}
+ --warning -s
+ ${vera_srcs}
+ DEPENDS ${vera_srcs}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMENT "Checking style for logdiag")
+
+ add_custom_target (logdiag_vera ALL DEPENDS ${vera_output})
+endif (OPTION_USE_VERA)
+
# GSettings
find_program (GLIB_COMPILE_SCHEMAS_EXECUTABLE glib-compile-schemas)
if (NOT GLIB_COMPILE_SCHEMAS_EXECUTABLE)
diff --git a/vera++ b/vera++
new file mode 160000
+Subproject b519b74ff8ecf792ee52eca7d294c64210f9938