# Which of path should set to ITK\_DIR

**URL:** <https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675>\
**Category:** Beginner Questions\
**Tags:** cmake\
**Created:** [December 15, 2021, 9:32am UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675 "2021-12-15T09:32:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xh\_c](https://discourse.itk.org/user_avatar/discourse.itk.org/xh_c/32/2294_2.png) [@xh\_c](https://discourse.itk.org/u/xh_c)\
**Post date:** [December 15, 2021, 9:32am UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/1 "2021-12-15T09:32:54Z")

</div>

Hello, I just build ITK with cmake. Now I have two folder, ITK\_source and ITK\_build. I set my ITK\_DIR to ITK\_build but get no head file error. And I found that some ITK module just have .obj file and no .cxx or .h. In ITK\_source folder I have head file.  
So could someone tell me how to set ITK\_DIR, or is there some mistake in my cmake building?

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [December 15, 2021, 12:34pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/2 "2021-12-15T12:34:09Z")

</div>

The `ITKConfig.cmake` file in your ITK\_build folder automatically includes the headers from your ITK\_source folder.

There must some kind of mistake in your building, did it compile without errors?. For sanity, I would recommend a fresh start, delete ITK\_build and start over.

---

<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:** [December 15, 2021, 2:52pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/3 "2021-12-15T14:52:24Z")

</div>

It is normal that source files (`.h`, `.hxx` and `.cxx`) are in source folder, and compiled files (`.obj`, `.lib`, `.dll` and `.exe`) in the build folder. When you need to provide `ITK_DIR` to your own project, use `ITK_build`.

---

<div class="post-metadata">

**Author:** ![xh\_c](https://discourse.itk.org/user_avatar/discourse.itk.org/xh_c/32/2294_2.png) [@xh\_c](https://discourse.itk.org/u/xh_c)\
**Post date:** [December 16, 2021, 2:00am UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/4 "2021-12-16T02:00:40Z")

</div>

Thanks for reply. I got this error because I do not set CMAKE\_INSTALL\_PREFIX to ITK\_source.  
But now I got new error for itkVTKImageToImageFilter.h not found but other .h work well.  
I add ITKGroup\_Bridge in cmake.  
 ![image](https://discourse.itk.org/uploads/default/original/2X/f/f9864fa1bcd74ff309f878657cf8b3758e18164e.png)

This is my cmakelist:

- set (ITK\_DIR “D:\C\_package\ITK\_build”)
- find\_package(ITK CONFIG REQUIRED)
- include("${ITK\_USE\_FILE}")
- target\_link\_libraries(Reconstruction ${ITK\_LIBRARIES})

---

<div class="post-metadata">

**Author:** ![phcerdan](https://discourse.itk.org/user_avatar/discourse.itk.org/phcerdan/32/286_2.png) [@phcerdan](https://discourse.itk.org/u/phcerdan)\
**Post date:** [December 16, 2021, 11:09am UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/5 "2021-12-16T11:09:37Z")

</div>

Great that you are making progress.

> CMAKE\_INSTALL\_PREFIX to ITK\_source

That’s wasn’t the source of the error. `CMAKE_INSTALL_PREFIX` only plays a role if you install the project, which you are not doing it (and that’s ok, you are using the build tree, not the install tree). And by the way, not good to set `CMAKE_INSTALL_PREFIX` to the source folder, choose any other folder to install it, or leave the default value.

`itkVTKImageToImageFilter.h` you need to install VTK for this (or build it), and provide a `VTK_DIR` to your build of ITK. Please read documentation and other posts about bridging VTK with ITK.

---

<div class="post-metadata">

**Author:** ![Amnesie](https://discourse.itk.org/user_avatar/discourse.itk.org/amnesie/32/1341_2.png) [@Amnesie](https://discourse.itk.org/u/Amnesie)\
**Post date:** [September 13, 2022, 5:28pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/6 "2022-09-13T17:28:42Z")

</div>

Thank you for explaining `CMAKE_INSTALL_PREFIX` . I want to know under what conditions I should execute install?

Because I found that after executing the install, the `lib` `bin` and other folders are created in the folder, and the contents are almost identical to those in the build folder

---

<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:** [September 13, 2022, 5:55pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/7 "2022-09-13T17:55:58Z")

</div>

The install folder does not contain intermediate build files. It is the preferred way of distributing a built version outside of your own computer.

---

<div class="post-metadata">

**Author:** ![Amnesie](https://discourse.itk.org/user_avatar/discourse.itk.org/amnesie/32/1341_2.png) [@Amnesie](https://discourse.itk.org/u/Amnesie)\
**Post date:** [September 14, 2022, 8:12pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/8 "2022-09-14T20:12:40Z")

</div>

Thank you for your quick reply, So if I want to release and debug two versions of the library, then I should install it twice and in different places, right?

---

<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:** [September 14, 2022, 8:22pm UTC](https://discourse.itk.org/t/which-of-path-should-set-to-itk-dir/4675/9 "2022-09-14T20:22:25Z")

</div>

You can install it in the same place. ITK gives slightly different file names to debug and release libraries. But debug version usually does not work on another computer. That is not an issue if you plan to just use ITK by an application or another library on the same computer.
