Skip to main content

cmake-checker

cmake-checker is a tool to search for violations to 'modern' cmake rules.

Usage

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)

What&Why tool warns about

  • file(GLOB ...)

    • CMake will not track the dependencies of a new file on disk correctly. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.
    • You can't ensure that only files you want are added. Globbing may pick up stray files that you do not want.
  • Functions

    • add_compile_options
    • add_compile_definitions
    • link_libraries
    • add_definitions
    • include_directories

    Functions work on directory scope instead of target scope. Every single one of listed functions has equivalent for target scope which should be used.

  • Properties COMPILE_<LANG>_FLAGS

    These properties should be set for a target - not modified globally

  • Closing commands with clauses

    • endif
    • endfunction
    • endmacro
    • endforeach

    Example:

    macro(foo ...)
    ...
    endmacro(foo)
    
  • Set/unset including

    • ENV
    • CACHE
  • ../.. in target_sources function

  • Set/unset PARENT_SCOPE outside of function declaration

Possibility to disable check

If you need to disable for any specific reasons checks you can do it using:

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

Metadata

Release files for cmake-checker 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmake-checker 0.1.3
File Size Uploaded Provenance Actions
cmake_checker-0.1.3.tar.gz 5.8 kB Without provenance Details for cmake_checker-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmake-checker 0.1.3
File Interpreter ABI Platform Actions
cmake_checker-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details for cmake_checker-0.1.3-py2.py3-none-any.whl

Total release size: 14.1 kB

Release files / cmake_checker-0.1.3.tar.gz

Download URL cmake_checker-0.1.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9ef6a9278b60aede070f30f65338c9682da7aa50316305cf93b4b28c10bcf59f
BLAKE2b-256 checksum
How to use checksums
5d32efac3ef9aaf20e3796ee68f1d8a62a37a477899ee7db4859f063d1822dfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

Release files / cmake_checker-0.1.3-py2.py3-none-any.whl

Download URL cmake_checker-0.1.3-py2.py3-none-any.whl
Size 8.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0b3250305cd5ef51a3801c8dda85680cf6e4e7abbded3e695bbe6a82f3c16249
BLAKE2b-256 checksum
How to use checksums
03331780fe1bca3c75209f5b7179682360bb88356fe67ac46b54fa225eab2462
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

Security for cmake-checker 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page