A simple example of how to set C++ static analisys in Jenkins pipeline. CMake has built-in capabilities to run clang-tidy, cppcheck, etc. See CXX_CLANG_TIDY and CXX_CPPCHECK for more details.
mkdir -p build
cd build
cmake -DBUILD_SAMPLE=ON ..
cmake --build .