Skip to main content

CMake build eXtension — configure, build, clean, and inspect CMake projects from the CLI

Project description

cmakex

A lightweight CMake build eXtension for the command line.

Wraps common CMake workflows and provides project introspection by parsing CMakeLists.txt.

Features

  • info — Parse CMakeLists.txt and display include directories, shared/static library output paths, and executables.
  • configure — Create the build directory and run cmake -S . -B build.
  • build / compile — Run cmake --build.
  • clean — Run the clean target, or --purge to delete the entire build directory.

Installation

pip install cmakex

Or install from source:

git clone https://github.com/winterYANGWT/cmakex.git
cd cmakex
pip install -e .

Quick Start

# Inspect the current project
cmakex info

# Configure (creates ./build, runs cmake)
cmakex configure -B build -G Ninja -D CMAKE_BUILD_TYPE=Release

# Build
cmakex build -B build -j8

# Or use the alias
cmakex compile -j$(nproc)

# Clean (runs make clean / ninja clean)
cmakex clean

# Remove the build directory entirely
cmakex clean --purge

Commands

cmakex info

cmakex info [-S SOURCE_DIR] [-B BUILD_DIR]

Parses CMakeLists.txt (and recursively any add_subdirectory() files) and prints:

  • Include directories from include_directories() / target_include_directories()
  • Shared libraries (.so) with output paths
  • Static libraries (.a) with output paths
  • Executables with output paths

Output paths are resolved from CMAKE_LIBRARY_OUTPUT_DIRECTORY, CMAKE_ARCHIVE_OUTPUT_DIRECTORY, CMAKE_RUNTIME_OUTPUT_DIRECTORY, and set_target_properties(… PROPERTIES …_OUTPUT_DIRECTORY …).

cmakex configure

cmakex configure [-S SOURCE_DIR] [-B BUILD_DIR] [-G GENERATOR] [-D KEY=VALUE ...] [-- EXTRA_CMAKE_ARGS]

Creates the build directory and runs:

cmake -S <source_dir> -B <build_dir> [-G <generator>] [-D <key=value>...] [extra...]

cmakex build / cmakex compile

cmakex build [-B BUILD_DIR] [-j N] [-t TARGET] [--config CONFIG] [-- EXTRA_ARGS]

Runs cmake --build <build_dir>. compile is an alias for build.

cmakex clean

cmakex clean [-B BUILD_DIR] [--purge]
  • Default: runs cmake --build <build_dir> --target clean
  • --purge: removes <build_dir> entirely (shutil.rmtree)

Global options

Flag Description
-h, --help Show help
--version Show version
-v, --verbose Print the cmake command before running

Requirements

  • Python ≥ 3.8
  • CMake ≥ 3.13 (for -S/-B flag support)
  • click ≥ 8.0

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmakex-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmakex-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file cmakex-0.1.0.tar.gz.

File metadata

  • Download URL: cmakex-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for cmakex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ebc53a59783b497b34980fb7673a23aac240da1ccc0eba455fbe73f18ccdb81
MD5 0b2c21be5314641a412940ba369d064d
BLAKE2b-256 d63951b14ca5d7293b294d6bbd14c48cb00c04b40834321a0fc8ecfee7da7965

See more details on using hashes here.

File details

Details for the file cmakex-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cmakex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for cmakex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fae925899cb93eb03cea4a5354474cd7153031a89a7f0de389bed040c8f0bc01
MD5 6fddc0a0cf509a2c2654133635bf1928
BLAKE2b-256 8d36475d36868c2e49b508bbe8229cc6750401570bdb92acdfc77b9ce56b58fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page