##// END OF EJS Templates
remise au norme de cppcheck (mise à jour de la version de sortie xml de 1 vers 2)
perrinel -
r10:b8cb68884afd
parent child
Show More
@@ -1,52 +1,52
1 1 #
2 2 # sciqlop_code_analysis.cmake
3 3
4 4 # Launch code source analysis with cppcheck. Can be activated with the
5 5 # ANALYZE_CODE option.
6 6 #
7 7 # The following CACHE variables are available:
8 8 # * CPPCHECK_EXTRA_ARGS: extra arguments for cppcheck;
9 9 # * CPPCHECK_OUTPUT: path to the xml report of cppcheck.
10 10 #
11 11 # The following variables are used (must be set by the cmake file calling this
12 12 # one):
13 13 # * ANALYSIS_INPUT_DIRS: directories to analyze;
14 14 # * ANALYSIS_EXCLUDE_DIRS: directories to exclude from the analysis.
15 15 #
16 16
17 17 #
18 18 # Analyze the source code with cppcheck
19 19 #
20 20 OPTION (ANALYZE_CODE "Analyze the source code with cppcheck" ON)
21 21 IF (ANALYZE_CODE)
22 22
23 23 # Make sure cppcheck has been found, otherwise the source code can't be
24 24 # analyzed
25 25 IF (CPPCHECK_FOUND)
26 SET (CPPCHECK_EXTRA_ARGS --inline-suppr --xml --enable=style --force -v
26 SET (CPPCHECK_EXTRA_ARGS --inline-suppr --xml --xml-version=2 --enable="warning,style" --force -v
27 27 CACHE STRING "Extra arguments for cppcheck")
28 28 MARK_AS_ADVANCED (CPPCHECK_EXTRA_ARGS)
29 29
30 30 SET (CPPCHECK_OUTPUT "${CMAKE_BINARY_DIR}/cppcheck-report.xml"
31 31 CACHE STRING "Output file for the cppcheck report")
32 32 MARK_AS_ADVANCED (CPPCHECK_OUTPUT)
33 33
34 34 SET (CPPCHECK_EXCLUDE_DIRS)
35 35 FOREACH (dir ${ANALYSIS_EXCLUDE_DIRS})
36 36 LIST (APPEND CPPCHECK_EXCLUDE_DIRS "-i${dir}")
37 37 ENDFOREACH ()
38 38
39 39 # Add the analyze target to launch cppcheck
40 40 ADD_CUSTOM_TARGET (analyze
41 41 COMMAND
42 42 ${CPPCHECK_EXECUTABLE}
43 43 ${CPPCHECK_EXTRA_ARGS}
44 44 ${ANALYSIS_INPUT_DIRS}
45 45 ${CPPCHECK_EXCLUDE_DIRS}
46 46 2> ${CPPCHECK_OUTPUT}
47 47 )
48 48
49 49 ELSE (CPPCHECK_FOUND)
50 50 MESSAGE (STATUS "The source code won't be analyzed - Cppcheck not found")
51 51 ENDIF (CPPCHECK_FOUND)
52 52 ENDIF (ANALYZE_CODE)
General Comments 0
You need to be logged in to leave comments. Login now