1#
2# Arm SCP/MCP Software
3# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -e
9
10tool_dir=$1
11version=$2
12
13url="https://github.com/danmar/cppcheck.git"
14
15echo -e "Installing cppcheck tool version: ${version}\n"
16
17# Create target folder
18mkdir -p ${tool_dir}
19pushd ${tool_dir}
20
21# Download
22git clone "${url}" --depth 1 --branch "${version}"  source
23
24# Build
25cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=${tool_dir} \
26        -DFILESDIR=${tool_dir} ./source
27cmake --build . -- install
28
29popd
30