# set up itk with visual studio and Cmake

**URL:** <https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772>\
**Category:** Beginner Questions\
**Created:** [April 10, 2019, 10:21am UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772 "2019-04-10T10:21:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abir](https://discourse.itk.org/user_avatar/discourse.itk.org/abir/32/1031_2.png) [@abir](https://discourse.itk.org/u/abir)\
**Post date:** [April 10, 2019, 10:21am UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772/1 "2019-04-10T10:21:29Z")

</div>

I have been trying to set up itk and got a problem while Itried to run Cmake on a HelloWorld project . I can’t figure out what’s the problem exactly !!  
 ![Capt](https://discourse.itk.org/uploads/default/original/1X/6c26cffaf0d0b3c66908efee5f14a7c03b777087.png)

---

<div class="post-metadata">

**Author:** ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)\
**Post date:** [April 10, 2019, 12:58pm UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772/2 "2019-04-10T12:58:05Z")

</div>

@abir welcome to ITK!

Following the error message, you need to provide the path to your ITK build (which will contain the `ITKConfig.cmake` or `itk-config.cmake` files) for the `ITK_DIR` variable in CMake.

HTH.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [April 10, 2019, 1:41pm UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772/3 "2019-04-10T13:41:03Z")

</div>

This is how it looks like on my computer:

 ![52](https://discourse.itk.org/uploads/default/original/1X/cdf94149f91c2c273fa0f77b6558da771921824c.png)

---

<div class="post-metadata">

**Author:** ![gmm9uf](https://discourse.itk.org/user_avatar/discourse.itk.org/gmm9uf/32/2810_2.png) [@gmm9uf](https://discourse.itk.org/u/gmm9uf)\
**Post date:** [July 23, 2022, 7:09pm UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772/4 "2022-07-23T19:09:50Z")

</div>

I am having the same issue – did you find a solution to your problem and/or could give me any advice on how to move forward?

I was previously using a Linux terminal to build and run code using cmake, and everything worked fine because I could use the command line argument that @jhlegarreta mentioned “-DITK\_DIR=./path/to/itk-build-directory/”

But in Visual Studios, I can’t find a place to add any command line arguments, to change the variable “CMAKE\_PREFIX\_PATH”, or to set “ITK\_DIR” to anything. I tried a few different ways of defining these variables in CMakePresets.json but none have solved the problem.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [July 25, 2022, 1:29pm UTC](https://discourse.itk.org/t/set-up-itk-with-visual-studio-and-cmake/1772/5 "2022-07-25T13:29:09Z")

</div>

Why not use CMake-GUI to generate Visual Studio project files?
