@@ -6,12 +6,38 @@ find_program(CODECHECKER_EXE NAMES CodeChecker codechecker REQUIRED)
66message (STATUS "Found SCA: CodeChecker (${CODECHECKER_EXE} )" )
77
88# Get CodeChecker specific variables
9+ zephyr_get(CODECHECKER_ANALYZE_JOBS)
910zephyr_get(CODECHECKER_ANALYZE_OPTS)
11+ zephyr_get(CODECHECKER_CONFIG_FILE)
1012zephyr_get(CODECHECKER_EXPORT)
13+ zephyr_get(CODECHECKER_NAME)
1114zephyr_get(CODECHECKER_PARSE_EXIT_STATUS)
1215zephyr_get(CODECHECKER_PARSE_OPTS)
16+ zephyr_get(CODECHECKER_PARSE_SKIP)
1317zephyr_get(CODECHECKER_STORE)
1418zephyr_get(CODECHECKER_STORE_OPTS)
19+ zephyr_get(CODECHECKER_STORE_TAG)
20+ zephyr_get(CODECHECKER_TRIM_PATH_PREFIX)
21+
22+ if (NOT CODECHECKER_NAME)
23+ set (CODECHECKER_NAME zephyr)
24+ endif ()
25+
26+ if (CODECHECKER_ANALYZE_JOBS)
27+ set (CODECHECKER_ANALYZE_JOBS "--jobs;${CODECHECKER_ANALYZE_JOBS} " )
28+ endif ()
29+
30+ if (CODECHECKER_CONFIG_FILE)
31+ set (CODECHECKER_CONFIG_FILE "--config;${CODECHECKER_CONFIG_FILE} " )
32+ endif ()
33+
34+ if (CODECHECKER_STORE_TAG)
35+ set (CODECHECKER_STORE_TAG "--tag;${CODECHECKER_STORE_TAG} " )
36+ endif ()
37+
38+ if (CODECHECKER_TRIM_PATH_PREFIX)
39+ set (CODECHECKER_TRIM_PATH_PREFIX "--trim-path-prefix;${CODECHECKER_TRIM_PATH_PREFIX} " )
40+ endif ()
1541
1642# CodeChecker uses the compile_commands.json as input
1743set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
@@ -31,7 +57,9 @@ add_custom_target(codechecker ALL
3157 --keep-gcc-include -fixed
3258 --keep-gcc-intrin
3359 --output ${output_dir} /codechecker.plist
34- --name zephyr # Set a default metadata name
60+ --name ${CODECHECKER_NAME} # Set a default metadata name
61+ ${CODECHECKER_CONFIG_FILE}
62+ ${CODECHECKER_ANALYZE_JOBS}
3563 ${CODECHECKER_ANALYZE_OPTS}
3664 ${CMAKE_BINARY_DIR} /compile_commands.json
3765 || ${CMAKE_COMMAND} -E true # allow to continue processing results
@@ -67,19 +95,23 @@ if(DEFINED CODECHECKER_EXPORT)
6795 ${output_dir} /codechecker.plist
6896 --export ${export_item}
6997 --output ${output_dir} /codechecker.${export_item}
98+ ${CODECHECKER_CONFIG_FILE}
99+ ${CODECHECKER_TRIM_PATH_PREFIX}
70100 ${CODECHECKER_PARSE_OPTS}
71101 BYPRODUCTS ${output_dir} /codechecker.${export_item}
72102 VERBATIM
73103 USES_TERMINAL
74104 COMMAND_EXPAND_LISTS
75105 )
76106 endforeach ()
77- else ( )
107+ elseif ( NOT CODECHECKER_PARSE_SKIP )
78108 # Output parse results
79109 add_custom_command (
80110 TARGET codechecker POST_BUILD
81111 COMMAND ${CODECHECKER_EXE} parse
82112 ${output_dir} /codechecker.plist
113+ ${CODECHECKER_CONFIG_FILE}
114+ ${CODECHECKER_TRIM_PATH_PREFIX}
83115 ${CODECHECKER_PARSE_OPTS}
84116 VERBATIM
85117 USES_TERMINAL
@@ -91,6 +123,9 @@ if(DEFINED CODECHECKER_STORE OR DEFINED CODECHECKER_STORE_OPTS)
91123 add_custom_command (
92124 TARGET codechecker POST_BUILD
93125 COMMAND ${CODECHECKER_EXE} store
126+ ${CODECHECKER_CONFIG_FILE}
127+ ${CODECHECKER_STORE_TAG}
128+ ${CODECHECKER_TRIM_PATH_PREFIX}
94129 ${CODECHECKER_STORE_OPTS}
95130 ${output_dir} /codechecker.plist
96131 VERBATIM
0 commit comments