# How to configure cmake to include Accelerators?

**URL:** https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452
**Category:** Support
**Created:** [January 18, 2020, 8:15pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452 "2020-01-18T20:15:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [January 18, 2020, 8:15pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/1 "2020-01-18T20:15:34Z")

</div>

I’m trying to use the vtkm accelerators in my VS2017 project but I’m having difficulty figuring out how to configure cmake…

Background,

- I built vtk from a git clone of master and include the Accelerators and TBB. This build appears to be good.

- Downloaded built and tested an example example from the new VTK Examples site

- Modified the example to include the use of the vtkmExternalFaces class  
`#include <vtkmExternalFaces.h>`  
`auto externalFaces = vtkSmartPointer<vtkmExternalFaces>::New();`

Building this caused a missing header error, so I modified the cmake flie and added a new line to find the Accelerators project

```
find_package(VTK COMPONENTS 
  vtkCommonColor
  vtkCommonCore
  vtkCommonDataModel
  vtkFiltersSources
  vtkInteractionStyle
  vtkRenderingCore
  vtkRenderingFreeType
  vtkRenderingOpenGL2 QUIET
  **VTK::AcceleratorsVTKm** )

```

cmake complains that it can’t find this package. I’ve tried multiple variations of the module name without success (unsurpringly…)

So - How can I include the Accelerators module in my project using cmake?

Thanks,

Doug

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 18, 2020, 10:34pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/2 "2020-01-18T22:34:02Z")

</div>

Hi, Douglas, g’day,

That package name is quite odd. It doesn’t seem valid. A module name usually corresponds to the name of any of the `*.cmake` files found where VTK is installed: `<vtk_install_directory>/lib/cmake/vtk-<VTK_version>/Modules`.

If I were to try module names, I’d look for them there.

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [January 19, 2020, 11:16pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/3 "2020-01-19T23:16:38Z")

</div>

Paulo,

Thanks for this info - but when I look in \<vtk\_install\_directory\>/lib/cmake/vtk-\<VTK\_version\> I don’t have a Modules folder…

When I look in \<vtk\_install\_directory\>/lib/Relese and Debug I do see the libraries I need- vtkAcceleratorsVTKm-8.90.lib. So I can always configure VS manually.

Any idea why I wouldn’t have a Modules folder? Could it be something to do with how I built vtk?

Doug

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 20, 2020, 11:41am UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/4 "2020-01-20T11:41:33Z")

</div>

Hello, Douglas! When you do a VTK deploy (e.g. `make install` with GCC or build the `INSTALL` project in VS’ solution) those `*.cmake` files were supposed to be there…

Anyway, since the module definition CMake files are not there, `find_package()` won’t work. But you can try to manually add libraries to link to your program with a [`target_link_libraries()`](https://cmake.org/cmake/help/v3.12/command/target_link_libraries.html) in your `CMakeLists.txt`.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 20, 2020, 11:48am UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/5 "2020-01-20T11:48:35Z")

</div>

If you opt to manually add libraries, you will also likely have to add include directories to your `CMakeLists.txt` too: [`target_include_directories()`](https://cmake.org/cmake/help/v3.16/command/target_include_directories.html#command:target_include_directories) so the compiler can find the respective header files.

---

<div class="post-metadata">

### Author: ![RobertMaynard](https://discourse.vtk.org/user_avatar/discourse.vtk.org/robertmaynard/32/24_2.png) [@RobertMaynard](https://discourse.vtk.org/u/RobertMaynard)
#### Post date: [January 20, 2020, 1:20pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/6 "2020-01-20T13:20:11Z")

</div>

The names to be given to `COMPONENTS` of the `find_package` call should not be prefixed with `vtk` or `VTK::` when using that latest version of VTK from `git`. In addition all the names of `COMPONENTS` must be concurrent, in your case you have `QUIET` mixed into the list, which will cause the query to fail.

So your call would be:

```auto
find_package(VTK COMPONENTS 
  CommonColor
  CommonCore
  CommonDataModel
  FiltersSources
  InteractionStyle
  RenderingCore
  RenderingFreeType
  RenderingOpenGL2 
  AcceleratorsVTKm
  QUIET)
```

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [January 20, 2020, 7:43pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/7 "2020-01-20T19:43:46Z")

</div>

Thanks Paulo,

I suspect I didn’t build the INSTALL project and just copied the files I needed to a convenient location…

I was able to get my project working by configuring the includes and libraries manually - I’ll investigate using the install project and see if that helps.

Most of my work with vtk is done using Python - but I’m slowly moving back to C++ so that I can access the vtkm filters. And I’m not very familiar with cmake either…

I’ll likely start to build the Python bindings from source so that I can access the vtkm accelerators from Python - they are not included in the vtk package from anaconda.

Thanks for the help!!!

Doug

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [January 20, 2020, 7:53pm UTC](https://discourse.vtk.org/t/how-to-configure-cmake-to-include-accelerators/2452/8 "2020-01-20T19:53:59Z")

</div>

Thanks Robert,

Moving QUIET to the end fixed the problem - even keeping the vtk prefixes…

Doug
