Comment corriger CMake 'Could not find a package configuration file provided by "VTK"' sur Ubuntu

Problème :

En essayant de compiler votre projet CMake, vous voyez un message d’erreur tel que

vtk_error.txt
CMake Error at cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake:29 (find_package):
  Could not find a package configuration file provided by "VTK" with any of
  the following names:

    VTKConfig.cmake
    vtk-config.cmake

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

Solution

install_libvtk9_dev.sh
sudo apt -y install libvtk9-dev

Notez que selon la version d’Ubuntu que vous utilisez, vous pourriez avoir besoin d’utiliser une version légèrement différente (9) de vtk. libvtk9-dev fonctionne pour Ubuntu 22.04


Consultez les articles similaires par catégorie : CMake Linux