How to fix CMake build error on Ubuntu: Could NOT find HarfBuzz (missing: HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY
Problem:
While building a software project using cmake
, you see error messages like
CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find HarfBuzz (missing: HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY
_HarfBuzz_REQUIRED_LIBS_FOUND)
Call Stack (most recent call first):
/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/FindHarfBuzz.cmake:153 (find_package_handle_standard_args)
CMakeLists.txt:801 (find_package)
Solution
Install libharfbuzz-dev
sudo apt -y install libharfbuzz-dev