# CMake Error: Could not find a configuration file for package "MyPackage" that requests exact version 2.0.0. Found version 2.1.0, but exact match required.

- **ID:** `cmake/find-package-version-exact-mismatch`
- **Domain:** cmake
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

find_package is called with EXACT version requirement, but the installed package has a different version (even if minor/patch differ).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.18 | active | — | — |
| 3.22 | active | — | — |
| 3.25 | active | — | — |
| 3.28 | active | — | — |

## Workarounds

1. **Update the find_package call to accept the installed version: find_package(MyPackage 2.1.0 EXACT) or remove EXACT if not strictly required.** (90% success)
   ```
   Update the find_package call to accept the installed version: find_package(MyPackage 2.1.0 EXACT) or remove EXACT if not strictly required.
   ```
2. **Install the exact required version of the package: on Ubuntu, use apt-get install mypackage=2.0.0 or build from source with the correct tag.** (85% success)
   ```
   Install the exact required version of the package: on Ubuntu, use apt-get install mypackage=2.0.0 or build from source with the correct tag.
   ```
3. **Use a version range if allowed: find_package(MyPackage 2.0.0...2.1.0 EXACT) is not valid; instead use find_package(MyPackage 2.0.0) without EXACT and add a custom version check.** (75% success)
   ```
   Use a version range if allowed: find_package(MyPackage 2.0.0...2.1.0 EXACT) is not valid; instead use find_package(MyPackage 2.0.0) without EXACT and add a custom version check.
   ```

## Dead Ends

- **Manually editing the package's version file to change the version number** — Editing the installed package file is a hack that may break other projects depending on the correct version. It is also overwritten on package updates. (90% fail)
- **Using find_package without EXACT but then adding a version check via if()** — The project may require EXACT for a reason (e.g., ABI compatibility). Removing EXACT can lead to subtle runtime failures. (70% fail)
- **Installing an older version of the package manually from source** — This can cause conflicts with other system packages that depend on the newer version, leading to dependency hell. (85% fail)
