{"id":22011263,"url":"https://github.com/jcelerier/cninja","last_synced_at":"2026-03-10T11:32:02.131Z","repository":{"id":149954400,"uuid":"254967604","full_name":"jcelerier/cninja","owner":"jcelerier","description":"an opinionated cmake config manager","archived":false,"fork":false,"pushed_at":"2025-03-21T22:18:39.000Z","size":196,"stargazers_count":41,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-06T19:09:56.352Z","etag":null,"topics":["clang","cmake","cpp","fast","lld","ninja"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcelerier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-11T22:39:46.000Z","updated_at":"2025-03-21T22:18:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb7a07f3-e414-40ce-95ac-b2bfc06cc7a5","html_url":"https://github.com/jcelerier/cninja","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/jcelerier/cninja","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcelerier%2Fcninja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcelerier%2Fcninja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcelerier%2Fcninja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcelerier%2Fcninja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcelerier","download_url":"https://codeload.github.com/jcelerier/cninja/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcelerier%2Fcninja/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30332287,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang","cmake","cpp","fast","lld","ninja"],"created_at":"2024-11-30T02:16:25.757Z","updated_at":"2026-03-10T11:32:02.112Z","avatar_url":"https://github.com/jcelerier.png","language":"C++","readme":"# cninja - an opinionated cmake config manager\n\n![Build status](https://github.com/jcelerier/cninja/workflows/Build/badge.svg)\n\nA project trying to set 22th century defaults to CMake calls, with a simplified syntax for the most common needs during development and an emphasis on build speed.\n\nThe tool works by generating a CMake toolchain file from a list of features passed in arguments, and running a `cmake ; cmake --build` cycle with that toolchain file. Requested features can have (acyclic) dependencies and will be ordered automatically if they do.\n\n## Installing\nEither download the [latest binary for your OS](https://github.com/jcelerier/cninja/releases/latest) or install it through your package manager of choice:  \n- ArchLinux AUR: `yay -S cninja`\n- MSYS2: `pacman -S cninja`\n- Homebrew: `brew tap jcelerier/packages \u0026\u0026 brew install cninja`\n\n## Features\n\n- Uses Ninja, Clang everywhere, and if possible libc++ and lld.\n- Generates `compile_commands.json` by default.\n- Forces you to use a recent clang with a recent C++ standard.\n- Configures and builds in one glorious stroke.\n- Does not scream at you.\n- Does not try to install in global system folders - the `install` target will copy things in a `build/install` folder.\n- Looks for config files in `.cninja` folders - easily create custom configs for your projects. \n\n## Usage\n\n    ### Produces a release build with debug symbols in \"build\"\n    $ git clone something\n    $ cd something\n    $ cninja\n\n    ### Produces a build in \"build-static-lto=thin\"\n    $ cninja static lto=thin\n\n    ### Produces a build in \"build-asan-ubsan-debugsyms-examples-tests\"\n    $ cninja asan ubsan debugsyms tests examples\n    \n    ### Produces a build of the /foo/bar folder with some CMake flags\n    $ cninja /foo/bar asan ubsan debugsyms -- -DCMAKE_PREFIX_PATH=/path/to/somelib\n    \n    ### Custom configurations \n    ### Can be per-project: \n    $ mkdir .cninja\n    $ echo 'string(APPEND CMAKE_CXX_FLAGS_INIT \" -Weverything\")' \u003e .cninja/all_warnings.cmake\n    \n    ### Or per-user:\n    $ mkdir $HOME/.cninja\n    $ echo 'set(CMAKE_PREFIX_PATH \"/home/myself/Qt/5.15/gcc_64\")' \u003e $HOME/.cninja/my_qt.cmake\n    \n    $ cninja all_warnings my_qt asan\n    \n    ### Don't set any of the default flags (i.e. use CMake defaults)\n    $ cninja plain\n    \n\nAs an example, here is a comparison of the default set-up of `cninja` and the same build type for CMake on the [Strawberry](https://github.com/strawberrymusicplayer/strawberry) software : \n\n| Tool   | Command                                                                 | First build | After changing a file |\n|--------|-------------------------------------------------------------------------|-------------|-----------------------|\n| cmake  | mkdir build\u003cbr\u003e cd build\u003cbr\u003e cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\u003cbr\u003ecmake --build . -- -j16   | 2m 40s      | 7.6s                  |\n| cninja | cninja                                                                  |  2m 16s     | 1.7s                  |\n\n\n## Goals\n\nThe main goal is to uniformize semantics across platforms, with the strictest choice prevailing, to make portability easier and not have bad surprises when porting software written on Linux to macOS or Windows.\n\nFor instance :\n * Symbols are hidden by default.\n * Dynamic library symbols are resolved at compile-time and early-bound.\n * Debug mode will perform iterator checking on all platforms.\n\nIt also splits the common \"Debug\" feature in its two orthogonal child features :\n * `debugsyms` will generate binaries with debug symbols.\n * `debugmode` will enable run-time checks and assertions in the standard library - the default for Debug in Windows, but generally not in Linux and Mac platforms.\n\nA further goal is to remove the need for adding various flags in each CMake file - ideally, CMake build scripts should just create targets and link libraries, not set up compiler flags. \nRunning for instance \n\n    $ rg --no-filename --only-matching '[A-Za-z0-9_]+_SANITIZE[A-Z]?' -g '*.cmake' | sort | uniq\n\nin my home directory reveals almost 30 distinct variables used in various CMake scripts to enable sanitizers... and even more if I also match CMakeLists.txt files. \n\n![No More !](https://66.media.tumblr.com/1e058c57c5907d24aa2a8508fe533fdc/tumblr_mx3vrl8ge41qjoke8o2_250.gif)\n\n# \"Is cninja for me ?\"\n\n- I downloaded a CMake project on Github and want to build it *presto*\n\n  🡆 Yes\n\n- I have wrist pain from the mere thought of typing `CMAKE_CXX_FLAGS_RELWITHDEBINFO` once more\n\n  🡆 Yes\n\n- My CMake files have options to enable sanitizers, LTO and build warnings\n\n  🡆 Yes (also, clean them !)\n\n- My projects have bash / powershell / python / perl / makefile / .travis.yml scripts which invoke CMake\n\n  🡆 Yes\n  \n- `history | grep cmake | grep CMAKE_` in my shell fills my terminal screen\n\n  🡆 Yes\n\n- I want to get shit done\n\n  🡆 Yes\n\n- I want to cross-compile\n\n  🡆 No\n\n- My project only builds in C++98 mode\n\n  🡆 No\n\n- I don't want my code to be portable across platforms\n\n  🡆 No\n\n- I like typing CFLAGS=\"...\" CXXFLAGS=\"...\"\n\n  🡆 You lie\n\n- I want Haiku or SerenityOS support\n\n  🡆 PRs accepted\n\n# Roadmap\n\n- PGO\n- Code coverage\n- ~Debug split -\u003e done\n- Downloading Clang / CMake / Ninja automatically if they aren't available\n- Some kind of improved support for common libraries\n    - Looking for Qt in `~/Qt/system/latest_version`\n    - Looking for Qt in `c:/Qt/system/latest_version`\n\n# Thanks\n\nCristian Adam for his [blog post on using Github actions](https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcelerier%2Fcninja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcelerier%2Fcninja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcelerier%2Fcninja/lists"}