Actions
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 12 years ago · 2 revisions