# rcmake > Independent drop-in reimplementation of CMake 4.5.1 in safe Rust. One multi-call binary runs as `cmake`, `ccmake` on macOS, Linux, and Windows, `ctest`, `cpack`, and `rcmake-lsp`, reading existing `CMakeLists.txt` files, presets, and caches and writing compatible build trees. `rcmake` 0.2.2 contains no copied or translated CMake C++ source code, and the core engine never invokes an upstream `cmake` binary at runtime. The audited Windows process interface in `rcmake-winproc/src/ffi.rs` contains the only project `unsafe` blocks. External Rust crates such as `rustix` and `memchr` use `unsafe` internally, and the native binary statically links `zstd` 1.5.7 and `liblzma` 5.8. Rust and Python code in this repository is dual-licensed under `MIT OR Apache-2.0`, while bundled CMake 4.5.1 `Modules/`, `Templates/`, `Help/`, and derived tables stay under `BSD-3-Clause`. `rcmake` is not affiliated with Kitware, and CMake is a trademark of Kitware, Inc. ## CMake 4.5.1 parity - **CLI tools in one binary.** Inspects `argv[0]` to run as `cmake`, `ccmake` on macOS, Linux, and Windows, `ctest`, `cpack`, or `rcmake-lsp` (`rcmake lsp`). Covers configure, generate, `-P` scripts, `-E` utilities, `--build`, `--install`, `--workflow`, `--find-package`, `--sarif-output`, and `--debugger` over Unix sockets or Windows named pipes. `ctest` handles parallel runs, GNU make jobserver access, fixtures, resources, JUnit and dashboard XML, and `-S` scripts. `cpack` handles archives (`TGZ`, `TXZ`, `TZST`, `TBZ2`, `TZ`, `TAR`, `STGZ`, `ZIP`, `7Z`), Linux `DEB` and `RPM`, `External`, macOS `Bundle`, `DragNDrop`, and `productbuild`, Windows `WIX` (v3 and v4), and cross-platform `NSIS`, `NSIS64`, and `IFW`. - **Two execution modes.** Running as `cmake`, `ccmake`, `ctest`, or `cpack`, or setting `RCMAKE_ORACLE_MODE=1`, selects strict CMake 4.5.1 compatibility mode. Running as `rcmake` selects native mode and keeps that persona across build-time regenerations. - **Generators.** `Ninja` and `Ninja Multi-Config` on macOS, Linux, and Windows, `Unix Makefiles` on macOS and Linux, `NMake Makefiles` on Windows, `Xcode` on macOS, and `Visual Studio 17 2022` and `Visual Studio 18 2026` on Windows. - **Languages.** C (C90 to C23), C++ with C++20 and C++23 named modules and Ninja `dyndep`, Objective-C, Objective-C++, Fortran with `.mod` scanning, CUDA (NVCC and Clang, separable compilation, device linking), HIP (AMD ROCm, SPIR-V, NVIDIA), Swift (`CMP0157`, `CMP0195`, `CMP0215`, `CMP0216`), `ASM`, `ASM_MASM`, `ASM_NASM`, Windows `RC`, and Qt `AUTOMOC`, `AUTOUIC`, and `AUTORCC`. - **CMake 4.5.1 interfaces.** Policies `CMP0000` to `CMP0226` (`CMP0000` to `CMP0065` always NEW, 161 active policies `CMP0066` to `CMP0226`), Presets schema v13, File API (`codemodel` v2.12, `cache` v2, `toolchains` v1, `cmakeFiles` v1, `configureLog` v1), CPS 0.15.0, SPDX 3.0.1 SBOM, Instrumentation API v1, `cmake_diagnostic()` with SARIF 2.1.0, and `compile_commands.json`. - **Platforms.** Prebuilt releases target `aarch64-apple-darwin`, `x86_64-unknown-linux-gnu`, `aarch64-unknown-linux-gnu`, and `x86_64-pc-windows-msvc`. Intel macOS builds from source. `rcmake-api` compiles to `wasm32-unknown-unknown` and `wasm32-wasip1`. ## Native extensions in rcmake mode - **Probe cache and portable CI archives.** Shares verified compiler checks across projects via SHA-256 input verification (`RCMAKE_PROBE_CACHE`), runs up to four literal compile probes concurrently (`RCMAKE_PROBE_JOBS`), supports HTTPS and S3 remote caches, and exchanges deterministic gzip tar archives with `rcmake cache export` and `rcmake cache import --sha256` (`RCMAKE_PROBE_CACHE_DIR`). - **Sound incremental configure replay.** Replays unchanged directory subtrees even when toolchain files (`vcpkg`), configure presets, `-C` scripts, or `PreLoad.cmake` are active by running setup spans live and checking setup checkpoints. - **Stale cache drift detection.** Native configures and `rcmake doctor -B ` warn when compiler binaries, toolchain files, launchers, or `CMAKE_PREFIX_PATH` drift from `CMakeCache.txt`. - **Provenance and inspection (`rcmake explain`).** Traces target flags (`--flag`), definitions (`--define`), includes (`--include`), dependency paths (`--dep`), variable writes (`--var`), `find_package()` rejections (`--find`, `why-not`), and generator expressions (`--eval`, `--eval-property`) in memory as text or JSON. - **Native inspection.** Use `rcmake explain --targets` to list project targets and `rcmake preset show ` to inspect a resolved preset. Configure can suggest corrections for unused `-D` variables. - **Build comparison (`rcmake diff-config`).** Compares any two `rcmake` or official `cmake` build directories or presets across targets, compile, link, toolchain, packages, and cache without running `cmake`. Use `--save` to write a portable snapshot for comparison on another machine. - **Lossless formatting and static linting.** `rcmake fmt` (`--check`, `--diff`, `--stdin`) and 8-rule `rcmake lint` (`--sarif`, `--list-rules`, `--deny-warnings`, `# rcmake-lint: disable=`) share `.rcmake.toml` configuration with `rcmake-lsp`. - **Isolated parity verification (`rcmake verify`).** Runs `rcmake` and a user-supplied CMake 4.5.1 binary side by side inside the isolated `rcmake-verify` companion binary. - **Multi-config `compile_commands.json`.** `--export-compile-commands` or `CMAKE_EXPORT_COMPILE_COMMANDS=ON` in native mode writes `compile_commands.json` plus `compile_commands_.json` on `Ninja Multi-Config`, `Xcode`, and `Visual Studio`. - **Profiling, hermetic audits, FetchContent lockfiles, and rich diagnostics.** `--profile`, `--hermetic`, `--fetch-lock`, and `--diagnostics=rich`. - **Language server and WebAssembly API.** `rcmake-lsp` (`rcmake lsp`) serves hover with evaluated values, formatting, and 8 lint rules over stdio, while `rcmake-api` embeds configure and `explain` in Rust and WebAssembly. ## Install - Linux and macOS release installer (`rcmake`, `rcmake-lsp`, `rcmake-verify`, completions, `rcmake(1)`, `ccmake(1)`), `curl -fsSL https://raw.githubusercontent.com/rcmake/rcmake/main/scripts/install.sh | bash`. - Linux and macOS with `cmake`, `ctest`, `cpack`, and `ccmake` symlinks, `curl -fsSL https://raw.githubusercontent.com/rcmake/rcmake/main/scripts/install.sh | bash -s -- --alias-cmake`. - Windows PowerShell installer, `irm https://raw.githubusercontent.com/rcmake/rcmake/main/scripts/install.ps1 | iex` (download first to pass `-AliasCmake`). - Build from source with Rust 1.99.1 and Python 3, `git clone https://github.com/rcmake/rcmake.git && cd rcmake && scripts/install.sh --from-source`. - The release workflow builds Homebrew, Scoop, and WinGet manifests from the release checksums. ## Intentional differences and limits - cmake-gui is not included. - CPack installer generators require the host packaging tool (`pkgbuild` and `productbuild`, `makensis`, `wix`, `binarycreator`), and `rcmake verify` requires a user-supplied CMake 4.5.1 binary. - Legacy extra generators (`CodeBlocks`, `CodeLite`, `Eclipse CDT4`, `Kate`, `Sublime Text 2`), older Makefile variants, `Green Hills MULTI`, `FASTBuild`, and Visual Studio 14 to 16 are omitted. - Reproducible `tar` and CPack archives record uid 0 and gid 0, `try_compile` runs in-process, and `--version` prints ` version 4.5.1` on line 1 and `rcmake 0.2.2` on line 2. - CUDA, HIP, and Swift target lowering are shipped, while standard CI runners lack GPU hardware and full Swift or HIP toolchains. ## Site and documentation - [Overview](https://rcmake.github.io/rcmake/) covers install commands, CMake 4.5.1 comparison, pipeline, generators, languages, and FAQ. - [Browser playground](https://rcmake.github.io/rcmake/playground.html) runs WebAssembly configure, Ninja generation, diagnostics, and `rcmake explain` locally. - [Compatibility report](https://rcmake.github.io/rcmake/dashboard.html) and [latest.json](https://rcmake.github.io/rcmake/data/latest.json) publish differential test results and benchmarks. - [Full technical reference](https://rcmake.github.io/rcmake/llms-full.txt) documents all CLI tools, architecture, caching, limits, and common questions. - [Documentation index](https://github.com/rcmake/rcmake/blob/main/docs/README.md) links to [README](https://github.com/rcmake/rcmake/blob/main/README.md), [TOOLING.md](https://github.com/rcmake/rcmake/blob/main/docs/TOOLING.md), [CACHING.md](https://github.com/rcmake/rcmake/blob/main/docs/CACHING.md), [FAQ.md](https://github.com/rcmake/rcmake/blob/main/docs/FAQ.md), [ENV_VARS.md](https://github.com/rcmake/rcmake/blob/main/docs/ENV_VARS.md), [ARCHITECTURE.md](https://github.com/rcmake/rcmake/blob/main/docs/ARCHITECTURE.md), [ADR.md](https://github.com/rcmake/rcmake/blob/main/docs/ADR.md) (57 ADRs), [BUILD_WRITEUP.md](https://github.com/rcmake/rcmake/blob/main/docs/BUILD_WRITEUP.md), [PRIOR_ART.md](https://github.com/rcmake/rcmake/blob/main/docs/PRIOR_ART.md), [rcmake-lsp README](https://github.com/rcmake/rcmake/blob/main/crates/rcmake-lsp/README.md), and [rcmake-api README](https://github.com/rcmake/rcmake/blob/main/crates/rcmake-api/README.md). - [GitHub repository](https://github.com/rcmake/rcmake) hosts source code, prebuilt releases, and parity bug reports.