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

Proposed by Michi Henning
Status: Merged
Approved by: Jussi Pakkanen
Approved revision: 56
Merged at revision: 57
Proposed branch: lp:~michihenning/unity-api/add-check-for-cppcheck
Merge into: lp:unity-api
Diff against target: 30 lines (+12/-8)
1 file modified
CMakeLists.txt (+12/-8)
To merge this branch: bzr merge lp:~michihenning/unity-api/add-check-for-cppcheck
Reviewer Review Type Date Requested Status
Jussi Pakkanen (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+169062@code.launchpad.net

Commit message

Added warning if cppcheck isn't found.

Description of the change

Added warning if cppcheck isn't found.
Fixes https://bugs.launchpad.net/unity-api/+bug/1190374

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Same comment as with unity-scopes-api.

review: Approve

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-06-10 23:56:09 +0000
3+++ CMakeLists.txt 2013-06-12 21:37:27 +0000
4@@ -46,14 +46,18 @@
5
6 # Static C++ checks
7
8-set(cppcheck_flags --check-config --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.

Subscribers

People subscribed via source and target branches

to all changes: