Skip to content

Commit dd11a2a

Browse files
committed
cmake: sca: iar: Refactor CSTAT_RULESET
Create a variable containing the parameters to be consumed by the IAR C-STAT Checks Manifest Handler, avoiding repetition. Signed-off-by: Felipe Torrezan <felipe.torrezan@iar.com>
1 parent e1a7240 commit dd11a2a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cmake/sca/iar/sca.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ zephyr_get(CSTAT_CLEANUP)
2727
set(output_dir ${CMAKE_BINARY_DIR}/sca/iar)
2828
file(MAKE_DIRECTORY ${output_dir})
2929

30-
# The IAR C-STAT ruleset defaults to `stdchecks`
30+
# Set the IAR C-STAT ruleset
31+
set(iar_checks_arg --output=${output_dir}/cstat_sel_checks.txt)
3132
if(CSTAT_RULESET MATCHES "^(cert|security|misrac2004|misrac\\+\\+2008|misrac2012)")
32-
execute_process(COMMAND ${IAR_CHECKS} --default=${CSTAT_RULESET} --output=${output_dir}/cstat_sel_checks.txt)
33+
set(iar_checks_arg ${iar_checks_arg} --default=${CSTAT_RULESET})
3334
elseif(CSTAT_RULESET MATCHES "^all")
34-
execute_process(COMMAND ${IAR_CHECKS} --all --output=${output_dir}/cstat_sel_checks.txt)
35+
set(iar_checks_arg ${iar_checks_arg} --all)
3536
else()
36-
execute_process(COMMAND ${IAR_CHECKS} --default=stdchecks --output=${output_dir}/cstat_sel_checks.txt)
37+
set(iar_checks_arg ${iar_checks_arg} --default=stdchecks)
3738
endif()
39+
execute_process(COMMAND ${IAR_CHECKS} ${iar_checks_arg})
40+
41+
# Forwards the ruleset manifest file to icstat
3842
set(output_arg --checks=${output_dir}/cstat_sel_checks.txt)
3943

40-
# Analysis parallelization
44+
# Analsys parallelization
4145
if(CSTAT_ANALYZE_THREADS)
4246
set(output_arg ${output_arg};--parallel=${CSTAT_ANALYZE_THREADS})
4347
endif()

0 commit comments

Comments
 (0)