CMake Error: Could not find a package configuration file provided by `<Pkg>`

Development package (`-dev`) is missing or `CMAKE_PREFIX_PATH` does not include its install prefix.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: CMake Error Platform: C/C++
Common Root Causes:
  • Development package (`-dev`) is missing or `CMAKE_PREFIX_PATH` does not include its install prefix.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Install `lib<pkg>-dev` or pass `-DCMAKE_PREFIX_PATH=/path/to/prefix`.
Safe Diagnostic Command:
find /usr -name "*Config.cmake" | grep -i <pkg>
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Development package (`-dev`) is missing or `CMAKE_PREFIX_PATH` does not include its install prefix. Recommended diagnostic: `find /usr -name "*Config.cmake" | grep -i <pkg>`. Remediation: Install `lib<pkg>-dev` or pass `-DCMAKE_PREFIX_PATH=/path/to/prefix`.

Worked Examples

  • Run `find /usr -name "*Config.cmake" | grep -i <pkg>` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-cpp-cmake-find-package-not-found · Independently verified: 2026-11-25

Related Resources