CMake "By not providing FindX.cmake ... could not find a package configuration file" in CI
find_package looks for a FindX.cmake module, then an XConfig.cmake config. When neither exists it prints "By not providing FindX.cmake ... could not find a package configuration file provided by X" and lists the prefixes it searched.
What this error means
Configuration fails at a find_package line, telling you to set X_DIR or add the install prefix to CMAKE_PREFIX_PATH because no config file was located.
CMake
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "Findfmt.cmake" in CMAKE_MODULE_PATH this project has asked
CMake to find a package configuration file provided by "fmt", but CMake did
not find one.
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 or add its prefix
- Install the development package that ships XConfig.cmake.
- If it is in a custom prefix, add that prefix to CMAKE_PREFIX_PATH.
Terminal
apt-get install -y libfmt-dev
# or point at a custom install
cmake -S . -B build -DCMAKE_PREFIX_PATH=/opt/fmtSet X_DIR to the config directory
When the config exists in a known place, point find_package straight at it with the X_DIR variable.
Terminal
cmake -S . -B build -Dfmt_DIR=/opt/fmt/lib/cmake/fmtHow to prevent it
- Install dependencies that ship CMake configs and set CMAKE_PREFIX_PATH for custom prefixes so find_package resolves the same way on every runner.
Related guides
CMake "imported target ... INTERFACE_INCLUDE_DIRECTORIES ... does not exist" in CIFix CMake "Imported target ... INTERFACE_INCLUDE_DIRECTORIES ... does not exist" in CI - a package config poi…
CMake "Could NOT find Boost (missing: ... )" in CIFix CMake "Could NOT find Boost (missing: Boost_INCLUDE_DIR ...)" in CI - find_package(Boost) cannot locate B…