cmake checker是一个搜索违反“现代”cmake规则的行为的工具。

cmake-checker的Python项目详细描述


cmake检查器

cmake checker是一个搜索违反“现代”cmake规则的行为的工具。

使用量

usage: __main__.py [-h] [--warn-only] [--reporter {console,junit}]
                        [-o OUTPUT_FILE] [--whitelist WHITELIST]
                        PATH [PATH ...]

positional arguments:
  PATH                  Path to the file or directory where the checks should
                        be done

optional arguments:
  -h, --help            show this help message and exit
  --warn-only           Program will return 0 even if violations are found
  --reporter {console,junit}
                        Specify type of reporter to output
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        Output results to file with given name
  --whitelist WHITELIST
                        Whitelist file with rules to ignore certain files or
                        dirs (.gitignore style)

工具警告

的原因
  • file(GLOB ...)

    • cmake将无法正确跟踪磁盘上新文件的依赖项。如果没有cmakelists.txt文件在源 添加或删除,则生成的生成系统无法知道何时要求cmake重新生成。
    • 无法确保仅添加所需的文件。globbing可能会收集您不需要的零散文件。
  • 功能

    • add_compile_options
    • add_compile_definitions
    • link_libraries
    • add_definitions
    • include_directories

    函数在目录作用域而不是目标作用域上工作。列出的每个函数都有 应使用的目标作用域的等效项。

  • 属性COMPILE_<LANG>_FLAGS

    应该为目标设置这些属性-不能全局修改

  • 带子句的关闭命令

    • endif
    • endfunction
    • endmacro
    • endforeach

    示例:

    macro(foo ...)
    ...
    endmacro(foo)
    
  • 设置/取消设置包括

    • ENV
    • CACHE
  • ../..target_sources函数中

  • 在函数声明之外设置/取消设置PARENT_SCOPE

禁用检查的可能性

如果由于任何特定原因需要禁用检查,可以使用:

# cmake-check disable
...
# cmake-check enable

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java GridBagLayout不填充区域   java Memozied Fibonacci未运行与常规Fibonacci解决方案   Java Web启动未启动问题   Java中异常和if-then的区别   java从命令提示符运行批处理文件获取错误   socket在Java中验证SSL证书的公共名称   如何在JAVA中检查字符串数组中的相等字   用java语言将音频文件转换成文本文件的语音识别   java为什么foo(1,2,3)没有传递给varargs方法foo(对象…)作为整数[]   java通过蓝牙将奇怪的数据从Arduino传输到Android   java ContainerRequestFilter获取空entitystream   java如何从安卓 studio中删除不兼容类型错误   基本Java错误   在Spring引导中使用REST API时发生java错误   javascript通过从SQL查询派生的URL打开页面