Merge lp:~michihenning/unity-scopes-api/add-check-for-cppcheck into lp:unity-scopes-api

Proposed by Michi Henning
Status: Merged
Approved by: Jussi Pakkanen
Approved revision: 7
Merged at revision: 11
Proposed branch: lp:~michihenning/unity-scopes-api/add-check-for-cppcheck
Merge into: lp:unity-scopes-api
Diff against target: 38 lines (+12/-9)
1 file modified
CMakeLists.txt (+12/-9)
To merge this branch: bzr merge lp:~michihenning/unity-scopes-api/add-check-for-cppcheck
Reviewer Review Type Date Requested Status
Jussi Pakkanen (community) Approve
Review via email: mp+169065@code.launchpad.net

Commit message

Added warning if cppcheck isn't found.

Description of the change

Added warning if cppcheck isn't found.

To post a comment you must log in.
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looks good. The only think to consider is whether the not found message should be a STATUS or WARNING. After all, cppcheck is not really required for the system to build and work. I'm fine either way.

review: Approve
Revision history for this message
Michi Henning (michihenning) wrote :

Warning seems right to me. Basically says "not every feature of the build environment will be available, but you can still build".

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-05-30 13:59:48 +0000
3+++ CMakeLists.txt 2013-06-12 21:44:29 +0000
4@@ -33,14 +33,18 @@
5
6 # Static C++ checks
7
8-set(cppcheck_flags --inline-suppr --enable=all -q --error-exitcode=2)
9-set(cppcheck_flags ${cppcheck_flags} --template '{file}({line}): {severity} ({id}): {message}')
10-
11-add_custom_target(cppcheck COMMAND cppcheck ${cppcheck_flags}
12- ${CMAKE_SOURCE_DIR}/src
13- ${CMAKE_SOURCE_DIR}/test
14- ${CMAKE_BINARY_DIR}/test
15-)
16+find_program(CPPCHECK_COMMAND NAMES cppcheck)
17+if (CPPCHECK_COMMAND)
18+ set(CPPCHECK_COMMAND_OPTIONS --check-config --inline-suppr --enable=all -q --error-exitcode=2)
19+ set(CPPCHECK_COMMAND_OPTIONS ${CPPCHECK_COMMAND_OPTIONS} --template '{file}({line}): {severity} ({id}): {message}')
20+ add_custom_target(cppcheck COMMAND ${CPPCHECK_COMMAND} ${CPPCHECK_COMMAND_OPTIONS}
21+ ${CMAKE_SOURCE_DIR}/src
22+ ${CMAKE_SOURCE_DIR}/test
23+ ${CMAKE_BINARY_DIR}/test
24+ )
25+else()
26+ message(WARNING "Cannot find cppcheck: cppcheck target will not be available")
27+endif()
28
29 #
30 # Definitions for testing with valgrind.
31@@ -134,7 +138,6 @@
32 # Documentation
33 #
34
35-message("lib: ${UNITY_SCOPES_LIB}")
36 find_package(Doxygen)
37 find_program(DOT_EXECUTABLE dot /usr/bin)
38 if (NOT DOXYGEN_FOUND OR NOT DOT_EXECUTABLE)

Subscribers

People subscribed via source and target branches

to all changes: