# Setup ITK

**URL:** https://discourse.itk.org/t/setup-itk/3007
**Category:** Beginner Questions
**Tags:** setup, cmake
**Created:** [April 25, 2020, 5:04pm UTC](https://discourse.itk.org/t/setup-itk/3007 "2020-04-25T17:04:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![c.spanakis83](https://discourse.itk.org/user_avatar/discourse.itk.org/c.spanakis83/32/737_2.png) [@c.spanakis83](https://discourse.itk.org/u/c.spanakis83)
#### Post date: [April 25, 2020, 5:04pm UTC](https://discourse.itk.org/t/setup-itk/3007/1 "2020-04-25T17:04:15Z")

</div>

Hello, i want to setup ITK using cmake and Visual studio 2019 Community edition. I want to install ITK so that I can create code that can be compiled and create exe that contain all the needed libraries and be able to execute the exe file in each computer that may not have ITK installed. How can I do it?

Thank you in advance,  
Constantinos Spanakis

---

<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 27, 2020, 1:59pm UTC](https://discourse.itk.org/t/setup-itk/3007/2 "2020-04-27T13:59:39Z")

</div>

Build ITK as static libraries.

When configuring ITK, make sure that `BUILD_SHARED_LIBS` is OFF. It should be OFF by default. Then compile your program normally - the executable should be big because it has needed parts of ITK embedded in it.

---

<div class="post-metadata">

### Author: ![c.spanakis83](https://discourse.itk.org/user_avatar/discourse.itk.org/c.spanakis83/32/737_2.png) [@c.spanakis83](https://discourse.itk.org/u/c.spanakis83)
#### Post date: [April 27, 2020, 5:35pm UTC](https://discourse.itk.org/t/setup-itk/3007/3 "2020-04-27T17:35:50Z")

</div>

Ok. I have a few questions.

1. When I compile ITK.sln in visual studio, shall I compile it using debug mode or release mode?

2. If i I want to create a program that embeds ITK libraries, should it be compiled in Visual studio in debug mode or release mode?

---

<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 27, 2020, 5:41pm UTC](https://discourse.itk.org/t/setup-itk/3007/4 "2020-04-27T17:41:30Z")

</div>

Normally, multiple configurations are compiled. I usually compile Debug and RelWithDebInfo. Static libraries work with all configurations.

Visual Studio’s limitation is that you cannot run Debug version of computers without Visual Studio installed on them, so you should compile in Release or RelWithDebInfo mode if you want to redistribute your program.

---

<div class="post-metadata">

### Author: ![c.spanakis83](https://discourse.itk.org/user_avatar/discourse.itk.org/c.spanakis83/32/737_2.png) [@c.spanakis83](https://discourse.itk.org/u/c.spanakis83)
#### Post date: [April 27, 2020, 6:12pm UTC](https://discourse.itk.org/t/setup-itk/3007/5 "2020-04-27T18:12:08Z")

</div>

This means that as long as a PC has Visual Studio installed, it doesn’t matter whether the code that uses itk and itk itself are compiled in debug or release mode.

Am I 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: [April 27, 2020, 6:57pm UTC](https://discourse.itk.org/t/setup-itk/3007/6 "2020-04-27T18:57:50Z")

</div>

Yes. Otherwise it cannot be debug.

---

<div class="post-metadata">

### Author: ![c.spanakis83](https://discourse.itk.org/user_avatar/discourse.itk.org/c.spanakis83/32/737_2.png) [@c.spanakis83](https://discourse.itk.org/u/c.spanakis83)
#### Post date: [April 27, 2020, 7:06pm UTC](https://discourse.itk.org/t/setup-itk/3007/7 "2020-04-27T19:06:21Z")

</div>

In the case where we have windows but not Visual studio installed, what can be done?

---

<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 28, 2020, 5:05pm UTC](https://discourse.itk.org/t/setup-itk/3007/8 "2020-04-28T17:05:50Z")

</div>

Use `RelWithDebInfo` configuration. It should have some debug symbols (some will be optimized away). But if there is no debugger on the target computer, why do debug symbols matter to you?
