cmakex
A lightweight CMake build eXtension for the command line.
Wraps common CMake workflows and provides project introspection by parsing CMakeLists.txt.
Features
info— ParseCMakeLists.txtand display include directories, shared/static library output paths, and executables.configure— Create the build directory and runcmake -S . -B build.build/compile— Runcmake --build.clean— Run thecleantarget, or--purgeto 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/-Bflag support) - click ≥ 8.0
License
MIT
Release files for cmakex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cmakex-0.1.0.tar.gz | 15.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cmakex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.0 kB
Release files / cmakex-0.1.0.tar.gz
| Download URL | cmakex-0.1.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ebc53a59783b497b34980fb7673a23aac240da1ccc0eba455fbe73f18ccdb81
|
|
BLAKE2b-256 checksum How to use checksums |
d63951b14ca5d7293b294d6bbd14c48cb00c04b40834321a0fc8ecfee7da7965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / cmakex-0.1.0-py3-none-any.whl
| Download URL | cmakex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fae925899cb93eb03cea4a5354474cd7153031a89a7f0de389bed040c8f0bc01
|
|
BLAKE2b-256 checksum How to use checksums |
8d36475d36868c2e49b508bbe8229cc6750401570bdb92acdfc77b9ce56b58fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|