# Cause CMake to find different VTK?

**URL:** <https://discourse.vtk.org/t/cause-cmake-to-find-different-vtk/11428>\
**Category:** Development\
**Created:** [May 10, 2023, 3:35pm UTC](https://discourse.vtk.org/t/cause-cmake-to-find-different-vtk/11428 "2023-05-10T15:35:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)\
**Post date:** [May 10, 2023, 3:35pm UTC](https://discourse.vtk.org/t/cause-cmake-to-find-different-vtk/11428/1 "2023-05-10T15:35:23Z")

</div>

I have the standard VTK libraries installed (mostly for use in Python), but I would like to try to build a C++ project, and use a _different_ set of libraries in `~/opt/vtk`. How would I give CMake a hint to look there first, instead of in `/usr/lib/x86_64-linux-gnu/cmake/vtk-9.1`?

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [May 10, 2023, 3:45pm UTC](https://discourse.vtk.org/t/cause-cmake-to-find-different-vtk/11428/2 "2023-05-10T15:45:43Z")

</div>

`-DCMAKE_PREFIX_PATH=~/opt/` or `-DVTK_DIR=~/opt/vtk/lib/cmake/vtk`.

---

<div class="post-metadata">

**Author:** ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)\
**Post date:** [May 10, 2023, 3:47pm UTC](https://discourse.vtk.org/t/cause-cmake-to-find-different-vtk/11428/3 "2023-05-10T15:47:27Z")

</div>

Thanks @mwestphal, that worked like a charm.
