我正在使用 CMake 3.6 生成 ninja 1.6.0 配置,使用 clang-tidy(LLVM 版本 3.9.1)编译和静态分析我的代码:
# file copied from http://www.labri.fr/perso/fleury/posts/programming/using-clang-tidy-and-clang-format.html
# Additional targets to perform clang-format/clang-tidy
# Get all project files
file(GLOB_RECURSE
ALL_CXX_SOURCE_FILES
*.[chi]pp *.[chi]xx *.cc *.hh *.ii *.[CHI]
)
# Adding clang-tidy target if executable is found
find_program(CLANG_TIDY "clang-tidy")
if(CLANG_TIDY)
add_custom_target(
clang-tidy
COMMAND clang-tidy
${ALL_CXX_SOURCE_FILES}
--
-std=c++11
${INCLUDE_DIRECTORIES}
)
endif()
.clang-tidy 文件:
---
Checks: '-*,readability-*'
AnalyzeTemporaryDtors: false
WarningsAsErrors: '*'
HeaderFilterRegex: 'src/'
User: mgalos
CheckOptions:
- key: readability-identifier-naming.AbstractClassCase
value: CamelCase
...
构建.bat:
cmake -H. -B_build -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=_build/_release -DCMAKE_BUILD_TYPE=GENERIC_RELEASE -DBoost_COMPILER=-vc100
我得到的输出是:
96 warnings treated as errors ninja: build stopped: subcommand failed.
为%errorlevel%
0,虽然 ninja 明确表示子命令失败。这个变量很重要,因为它由构建服务器评估并将构建标记为失败。
我该怎么做才能%errorlevel%
正确设置为!= 0?