set up itk with visual studio and Cmake

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 !!

@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.


1 Like

This is how it looks like on my computer:

1 Like

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.

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