CMake "Could not find a package configuration file provided by X" in CI
A find_package() in CONFIG mode looked for X-config.cmake or XConfig.cmake and found none in any searched prefix. The package is not installed or not on CMAKE_PREFIX_PATH.
What this error means
Configure aborts naming the package and listing the directories CMake searched for its config file, on a CI image where the dependency is absent.
cmake
CMake Error at CMakeLists.txt:6 (find_package):
Could not find a package configuration file provided by "fmt" with any of
the following names:
fmtConfig.cmake
fmt-config.cmakeCommon causes
How to fix it
Install the package and point CMake at it
- Install the dependency (and its -dev package) that ships the config file.
- Pass CMAKE_PREFIX_PATH for packages in a custom prefix.
cmake
apt-get install -y libfmt-dev
cmake -S . -B build -DCMAKE_PREFIX_PATH=/opt/fmtHow to prevent it
- Provision all find_package dependencies in the runner image and pass CMAKE_PREFIX_PATH for any in a non-standard prefix.
Frequently asked questions
What causes ""Could not find a package configuration file""?
Configure aborts naming the package and listing the directories CMake searched for its config file, on a CI image where the dependency is absent.
How do I fix "Could not find a package configuration file"?
Install the package and point CMake at it
Related guides
CMake "Cannot find source file" in CIFix CMake "Cannot find source file" in CI - a file listed in add_executable/add_library does not exist at the…
gcc/clang "fatal error: X.h: No such file or directory" in CIFix gcc/clang "fatal error: X.h: No such file or directory" in CI - a header is not installed or its director…
CMake "Could NOT find <Package> (missing: <Package>_DIR)"Fix CMake "Could NOT find <Package> (missing: <Package>_DIR)" in CI - a find_package() dependency is not inst…