@@ -13,6 +13,7 @@ message(STATUS "Found SCA: CodeChecker (${CODECHECKER_EXE})")
1313# Get CodeChecker specific variables
1414zephyr_get(CODECHECKER_ANALYZE_JOBS)
1515zephyr_get(CODECHECKER_ANALYZE_OPTS)
16+ zephyr_get(CODECHECKER_CLEANUP)
1617zephyr_get(CODECHECKER_CONFIG_FILE)
1718zephyr_get(CODECHECKER_EXPORT)
1819zephyr_get(CODECHECKER_NAME)
@@ -95,6 +96,16 @@ add_custom_command(
9596 COMMAND ${CMAKE_COMMAND} -E rm ${output_dir} /codechecker.ready
9697)
9798
99+ if (CODECHECKER_CLEANUP)
100+ add_custom_target (codechecker-cleanup ALL
101+ COMMAND ${CMAKE_COMMAND} -E rm -r ${output_dir} /codechecker.plist
102+ )
103+ else ()
104+ add_custom_target (codechecker-cleanup)
105+ endif ()
106+
107+ add_dependencies (codechecker-cleanup codechecker)
108+
98109# If 'codechecker parse' returns an exit status of '2', it means more than 0
99110# issues were detected. Suppress the exit status by default, but permit opting
100111# in to the failure.
@@ -122,6 +133,7 @@ if(DEFINED CODECHECKER_EXPORT)
122133 COMMAND_EXPAND_LISTS
123134 )
124135 add_dependencies (codechecker-report-${export_item} codechecker)
136+ add_dependencies (codechecker-cleanup codechecker-report-${export_item} )
125137 endforeach ()
126138elseif (NOT CODECHECKER_PARSE_SKIP)
127139 # Output parse results
@@ -136,6 +148,7 @@ elseif(NOT CODECHECKER_PARSE_SKIP)
136148 COMMAND_EXPAND_LISTS
137149 )
138150 add_dependencies (codechecker-parse codechecker)
151+ add_dependencies (codechecker-cleanup codechecker-parse)
139152endif ()
140153
141154if (DEFINED CODECHECKER_STORE OR DEFINED CODECHECKER_STORE_OPTS)
@@ -151,4 +164,5 @@ if(DEFINED CODECHECKER_STORE OR DEFINED CODECHECKER_STORE_OPTS)
151164 COMMAND_EXPAND_LISTS
152165 )
153166 add_dependencies (codechecker-store codechecker)
167+ add_dependencies (codechecker-cleanup codechecker-store)
154168endif ()
0 commit comments