# Can't build VTK sample project: Missing module

**URL:** https://discourse.vtk.org/t/cant-build-vtk-sample-project-missing-module/8056
**Category:** Support
**Created:** [March 15, 2022, 11:55am UTC](https://discourse.vtk.org/t/cant-build-vtk-sample-project-missing-module/8056 "2022-03-15T11:55:19Z")
**Posts on this page:** 1
**Showing post:** 22

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [March 15, 2022, 7:50pm UTC](https://discourse.vtk.org/t/cant-build-vtk-sample-project-missing-module/8056/22 "2022-03-15T19:50:53Z")

</div>

The easiest way (quick and dirty) to set the cache variables is to edit the `CMakeCache.txt` file directly, and then re-run cmake. But this has to be repeated each time you do a clean build, so it’s not ideal.

Another way is by passing multiple `-D` values when you run cmake, one for each variable. This can be tedious, but you can put the whole cmake command-line into a bash script to make it reusable.

For putting cache variables into a `CMakeLists.txt`, it’s necessary to use the `CACHE` keyword in the `set()` command:

```auto
set(CMAKE_BUILD_TYPE Release CACHE STRING "")

```

syntax: (note that `<docstring>` can be an empty string)

```auto
set(<variable> <value> CACHE <type> <docstring> [FORCE])

```

Instead of putting these in the `CMakeLists.txt`, they can be put in their own cmake file, e.g. a file called `cache.cmake` that is used like this:

```nohighlight
cmake -C cache.cmake ...

```

where `cache.cmake` contains

```auto
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
set(CMAKE_PREFIX_PATH
/home/ilmu011/Desktop/vcpkg/installed/x64-linux/share/vtk
CACHE PATH ""
)

```

It’s verbose, which is why using `-D` is more common.

Make sure that you have `libfreetype-dev` installed, it’s possible that cmake didn’t automatically find the system libs and headers for freetype because they’re not installed on your system.

Hopefully someone else can answer the vcpkg questions, because I don’t really know anything about it, except that it exists.

---

_[View the full topic](https://discourse.vtk.org/t/cant-build-vtk-sample-project-missing-module/8056)._
