From 6a069e14e7c1a124e7469eed14f1239874918596 Mon Sep 17 00:00:00 2001 From: Yasushi SHOJI Date: Sun, 21 Jan 2024 17:27:25 +0900 Subject: [PATCH] cmake: sca: Add Parasoft C++test This commit adds Parasoft C++test as a Static Analyser using Zephyr's SCA framework. By specifing -DZEPHYR_SCA_VARIANT=cpptest to west build, a cpptestscan.bdf file will be generated under builddir/sca/cpptest/. Signed-off-by: Yasushi SHOJI --- cmake/sca/cpptest/sca.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cmake/sca/cpptest/sca.cmake diff --git a/cmake/sca/cpptest/sca.cmake b/cmake/sca/cpptest/sca.cmake new file mode 100644 index 00000000000..cc226345d1c --- /dev/null +++ b/cmake/sca/cpptest/sca.cmake @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Space Cubics, LLC. + +find_program(CPPTESTSCAN cpptestscan REQUIRED) +message(STATUS "Found SCA: Parasoft C/C++test (${CPPTESTSCAN})") + +set(output_dir ${CMAKE_BINARY_DIR}/sca/cpptest) +file(MAKE_DIRECTORY ${output_dir}) + +set(output_file ${output_dir}/cpptestscan.bdf) +set(output_arg --cpptestscanOutputFile=${output_file}) + +set(CMAKE_C_COMPILER_LAUNCHER ${CPPTESTSCAN} ${output_arg} CACHE INTERNAL "") +set(CMAKE_CXX_COMPILER_LAUNCHER ${CPPTESTSCAN} ${output_arg} CACHE INTERNAL "")