# Problem with cmake FetchContent

**URL:** https://discourse.vtk.org/t/problem-with-cmake-fetchcontent/10967
**Category:** Support
**Created:** [March 14, 2023, 3:18pm UTC](https://discourse.vtk.org/t/problem-with-cmake-fetchcontent/10967 "2023-03-14T15:18:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BlackCatRuelle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/blackcatruelle/32/6723_2.png) [@BlackCatRuelle](https://discourse.vtk.org/u/BlackCatRuelle)
#### Post date: [March 14, 2023, 3:18pm UTC](https://discourse.vtk.org/t/problem-with-cmake-fetchcontent/10967/1 "2023-03-14T15:18:48Z")

</div>

Hi, I am trying to cmake’s FetchContent to build VTK with my project. Cmake failed to configure the project. I tried to set the VTK\_DIR to the VTK source dir and it did work either. Here is my CMakeLists.txt file. Could anybody tell me what I am doing wrong here? You help would be greatly appreciated.

```auto
project(CylinderExample)

include(FetchContent)

message(STATUS "Fetching VTK...")

set(VTK_BUILD_TESTING OFF)
set(VTK_BUILD_EXAMPLES OFF)
set(VTK_USE_CUDA ON)

set(VTK_REQUESTED_VERSION "v9.2.6" CACHE STRING "The requested VTK version")

FetchContent_Declare(
  VTK
  URL https://github.com/Kitware/VTK/archive/refs/tags/${VTK_REQUESTED_VERSION}.zip
)

FetchContent_MakeAvailable(VTK)

find_package(VTK COMPONENTS 
  CommonColor
  CommonCore
  FiltersSources
  InteractionStyle
  RenderingContextOpenGL2
  RenderingCore
  RenderingFreeType
  RenderingGL2PSOpenGL2
  RenderingOpenGL2
)

if (NOT VTK_FOUND)
  message(FATAL_ERROR "CylinderExample: Unable to find the VTK build folder.")
endif()

# Prevent a "command line is too long" failure in Windows.
set(CMAKE_NINJA_FORCE_RESPONSE_FILE "ON" CACHE BOOL "Force Ninja to use response files.")
add_executable(CylinderExample CylinderExample.cpp)
target_link_libraries(CylinderExample PRIVATE ${VTK_LIBRARIES})

# vtk_module_autoinit is needed
vtk_module_autoinit(
  TARGETS CylinderExample
  MODULES ${VTK_LIBRARIES}
)
```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [March 16, 2023, 6:03pm UTC](https://discourse.vtk.org/t/problem-with-cmake-fetchcontent/10967/2 "2023-03-16T18:03:14Z")

</div>

> [@BlackCatRuelle](#):
>
> Cmake failed to configure the project. I tried to set the VTK\_DIR to the VTK source dir and it did work either

What error message(s) did you get?
