# CMake Error: Could not create named generator 'Ninja'. Generator 'Ninja' is not available. Use 'cmake --help' to see a list of available generators.

- **ID:** `cmake/generator-ninja-not-found`
- **Domain:** cmake
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

CMake was invoked with -GNinja but Ninja is not installed or not in PATH, or the CMake installation does not include the Ninja generator (e.g., minimal install).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.14 | active | — | — |
| 3.20 | active | — | — |
| 3.24 | active | — | — |
| 3.27 | active | — | — |

## Workarounds

1. **Install Ninja: on Ubuntu, run 'sudo apt-get install ninja-build'; on macOS, 'brew install ninja'; on Windows, download from https://ninja-build.org/ and add to PATH.** (95% success)
   ```
   Install Ninja: on Ubuntu, run 'sudo apt-get install ninja-build'; on macOS, 'brew install ninja'; on Windows, download from https://ninja-build.org/ and add to PATH.
   ```
2. **Use a different generator such as Unix Makefiles: cmake -G "Unix Makefiles" ..** (90% success)
   ```
   Use a different generator such as Unix Makefiles: cmake -G "Unix Makefiles" ..
   ```
3. **If Ninja is installed but not in PATH, specify the full path: cmake -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja ..** (85% success)
   ```
   If Ninja is installed but not in PATH, specify the full path: cmake -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja ..
   ```

## Dead Ends

- **Reinstalling CMake without selecting the Ninja generator option** — The Ninja generator is part of CMake's built-in generators; a reinstall without ensuring Ninja is in PATH does not help. (90% fail)
- **Setting CMAKE_GENERATOR to Ninja in CMakeLists.txt** — The generator is selected before CMakeLists.txt is parsed, so this setting has no effect; the error occurs at the configuration stage. (95% fail)
- **Using -G "Ninja Multi-Config" as a substitute** — If Ninja is not installed, the multi-config generator also fails because it requires the same underlying build tool. (85% fail)
