How to fix CMake 'Failed to find XercesC...' on Ubuntu

Problem:

When trying to compile your CMake project, you see an error message such as

CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Failed to find XercesC (missing: XercesC_LIBRARY XercesC_INCLUDE_DIR
  XercesC_VERSION)
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.25/Modules/FindXercesC.cmake:112 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cMake/FreeCAD_Helpers/SetupXercesC.cmake:4 (find_package)
  CMakeLists.txt:61 (SetupXercesC)

Solution

sudo apt -y install libxerces-c-dev