How to fix CMake 'Could not find a package configuration file provided by "yaml-cpp" ...' on Ubuntu

Problem:

When you try to build a CMake project, you see an error message such as

CMake Error at cMake/FreeCAD_Helpers/SetupLibYaml.cmake:3 (find_package):
  By not providing "Findyaml-cpp.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "yaml-cpp",
  but CMake did not find one.

  Could not find a package configuration file provided by "yaml-cpp" with any
  of the following names:

    yaml-cppConfig.cmake
    yaml-cpp-config.cmake

  Add the installation prefix of "yaml-cpp" to CMAKE_PREFIX_PATH or set
  "yaml-cpp_DIR" to a directory containing one of the above files.  If
  "yaml-cpp" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:56 (SetupYamlCpp)

Solution

sudo apt -y install libyaml-cpp-dev