Project

General

Profile

Actions

ClangAnalyzer » History » Revision 1

Revision 1/2 | Next »
stbuehler, 2009-07-16 22:07


Using Clang Analyzer with cmake

Download/Compile from http://clang-analyzer.llvm.org/

Add it to your path (or install it):

export PATH="/opt/llvm/Debug/bin:$PATH" 

Locate scan-build and ccc-analyzer, for example /opt/llvm/tools/clang/utils/scan-build and /opt/llvm/tools/clang/utils/ccc-analyzer.

Configure your cmake build (start in source directory):

mkdir clangbuild
cd clangbuild
cmake -DCMAKE_C_COMPILER=/opt/llvm/tools/clang/utils/ccc-analyzer ..

Build it:

/opt/llvm/tools/clang/utils/scan-build make

Example wrappers

scan-cmake-configure:

#!/bin/bash

export PATH="/opt/llvm/Debug/bin:$PATH" 
cmake -DCMAKE_C_COMPILER=/opt/llvm/tools/clang/utils/ccc-analyzer "$@" 

scan-cmake-build:

#!/bin/bash

export PATH="/opt/llvm/Debug/bin:$PATH" 
/opt/llvm/tools/clang/utils/scan-build make "$@" 

Updated by stbuehler over 15 years ago · 2 revisions