How to fix CMake 'Failed to find Qt component "SvgWidgets"' on Ubuntu


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

CMake Error at cMake/FreeCAD_Helpers/SetupQt.cmake:33 (find_package):
  Found package configuration file:


  but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
  FOUND.  Reason given by package:

  Failed to find Qt component "SvgWidgets".

  Expected Config file at
  does NOT exist


Call Stack (most recent call first):
  CMakeLists.txt:82 (include)



sudo apt -y install libqt6svg6-dev

Tested on Ubuntu 22.04