# Would like to compile the ITK without external third-party libraries

**URL:** https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632
**Category:** Engineering
**Created:** [September 18, 2025, 1:56am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632 "2025-09-18T01:56:59Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 18, 2025, 1:56am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/1 "2025-09-18T01:56:59Z")

</div>

Dear developers,

I’m attempting to compile all possible ITK target without external third-party libraries. I’m not sure if it will NOT compile all modules that depend on external third-party libraries when I set the ITKGroup\_ThirdParty off.

Thanks for your support.

Best regards,

Rosie

---

<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 18, 2025, 12:53pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/2 "2025-09-18T12:53:03Z")

</div>

In ITK’s build system, you indicate which modules you want built. There is no way to indicate some modules to not be built. During configure step, there are messages such as `Enabled ITKBridgeNumPy, requested by ITK_BUILD_DEFAULT_MODULES.` Examining these allows you to see which modules were built, and why (what module needs them). You need to turn off all the modules which need the modules you want to exclude.

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 19, 2025, 1:50am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/3 "2025-09-19T01:50:50Z")

</div>

Yes, I see the message. But I don’t know which modules depend on external third-party libraries.

---

<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 19, 2025, 12:45pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/4 "2025-09-19T12:45:54Z")

</div>

Typically similarly named modules, e.g. [ITKIODCMTK](https://github.com/InsightSoftwareConsortium/ITK/blob/v5.4.4/Modules/IO/DCMTK/itk-module.cmake#L7) depends on [ITKDCMTK](https://github.com/InsightSoftwareConsortium/ITK/blob/v5.4.4/Modules/ThirdParty/DCMTK/itk-module.cmake#L13). Almost all IO modules depend on some third party module. There are also some optional dependencies, e.g. ITKCommon depends on [TBB](https://github.com/InsightSoftwareConsortium/ITK/tree/v5.4.4/Modules/ThirdParty/TBB) when CMake option `Module_ITKTBB` is turned on. To get more comprehensive insight into dependencies, you could put some `message` statements [here](https://github.com/InsightSoftwareConsortium/ITK/blob/298fe0949aed2e7eff986d62d6a2fb19797f04d8/CMake/ITKModuleEnablement.cmake#L103-L237).

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 22, 2025, 9:06am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/5 "2025-09-22T09:06:31Z")

</div>

Most IO modules are commercially viable, so it’s okay. I just need to compile third-party libraries without the risk of license infection.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [September 22, 2025, 11:49am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/6 "2025-09-22T11:49:09Z")

</div>

Hi @Rosie ,

The third party libraries distributed with ITK are all commercial-friendly. For more information, see the [licenses documentation](https://docs.itk.org/en/latest/licenses.html).

To build common third party libraries externally, set the CMake variable: `ITK_USE_SYSTEM_LIBRARIES` during initial configuration.

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 23, 2025, 3:46am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/7 "2025-09-23T03:46:25Z")

</div>

That’s great. I learned that ITKFFT module has integrated with FFTW (Fastest Fourier Transform in the West), which requires GPL license. So are those third-party integrated modules commercial-friendly?

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [September 23, 2025, 8:49am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/8 "2025-09-23T08:49:34Z")

</div>

No but FFTW is not included by default, you need to activate it in ITK:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/main/CMakeLists.txt#L608>

I know it’s used by some vendors, for which they pay license fees.

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 23, 2025, 10:13am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/9 "2025-09-23T10:13:10Z")

</div>

Yeah, I am worried that there might still be dependencies similar to FFTW. Is there a list of modules that needs extra license? In that case I can check these modules and ensure they are not included. I would like to compile modules as more as possible, without any extra license pay.

---

<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 23, 2025, 1:29pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/10 "2025-09-23T13:29:47Z")

</div>

I remember that Intel’s MKL was free to use, and it can replace FFTW. It might be [called differently now](https://github.com/uxlfoundation/oneMath).

---

<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 23, 2025, 1:31pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/11 "2025-09-23T13:31:12Z")

</div>

FFTW might be the only one. I think it raises a warning during CMake configure step when enabled.

---

<div class="post-metadata">

### Author: ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)
#### Post date: [September 23, 2025, 2:08pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/12 "2025-09-23T14:08:46Z")

</div>

Maybe check the list in the doc

> **[ITK Software Licenses](https://docs.itk.org/en/latest/licenses.html)**
>
> The copyright of the Insight Toolkit (ITK) is held by: Copyright 1999-2019 Insight Software Consortium Copyright 2020-present NumFOCUS This software is distributed under the Apache 2.0 License. See...

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 23, 2025, 5:56pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/13 "2025-09-23T17:56:31Z")

</div>

I’ve checked the list and found ITK didn’t include any package under GPL license. And the only risky part, FFTW, is not included by default. So, it means that I can just compile all ITK modules without license infection risk?

---

<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 23, 2025, 7:14pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/14 "2025-09-23T19:14:32Z")

</div>

That is correct.

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 24, 2025, 12:51am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/15 "2025-09-24T00:51:18Z")

</div>

I got it. Thank you so much for your help!

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 26, 2025, 3:31am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/16 "2025-09-26T03:31:00Z")

</div>

Hi all,

I’ve attempted to build all of the default and optional modules, as well as all testing and example. There are several errors during configuration and generation. I just simply turn these corresponding modules off, and it works. I’m not sure if some of them are bugs, so here provide these errors for your reference.

> _ **Modules** _
> 
> **VkFFTBackend** : turn off because FFTW GPL risk
> 
> **WebAssemblyInterface** : need to git clone manually
> 
> CMake Error at CMake/ITKModuleRemote.cmake:111 (message): Failed to checkout tag: ‘982daf8ea91d5ecb052c3bf707542dbc43a4d1ef’ Call Stack (most recent call first): CMake/ITKModuleRemote.cmake:145 (\_git\_update) CMake/ITKModuleRemote.cmake:273 (\_fetch\_with\_git) Modules/Remote/WebAssemblyInterface.remote.cmake:45 (itk\_fetch\_module) Modules/Remote/CMakeLists.txt:21 (include)
> 
> **ITKTBB** : compiled by default module, so don’t need to turn on
> 
> CMake Error at Modules/ThirdParty/TBB/itk-module-init.cmake:2 (find\_package): Could not find a package configuration file provided by “TBB” with any of the following names: TBBConfig.cmake tbb-config.cmake Add the installation prefix of “TBB” to CMAKE\_PREFIX\_PATH or set “TBB\_DIR” to a directory containing one of the above files. If “TBB” provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMake/ITKModuleEnablement.cmake:374 (include) CMakeLists.txt:583 (include)
> 
> **IOOpenSlide** : turn off because LGPL risks
> 
> CMake Error at Modules/Remote/IOOpenSlide/CMakeLists.txt:8 (message):
> 
> Please specify OPENSLIDE\_LIBRARY and OPENSLIDE\_INCLUDE\_DIR.
> 
> **ITKVideoBridgeOpenCV** ：need to install OpenCV in system
> 
> CMake Error at Modules/Video/BridgeOpenCV/itk-module-init.cmake:4 (find\_package):
> 
> By not providing “FindOpenCV.cmake” in CMAKE\_MODULE\_PATH this project has
> 
> asked CMake to find a package configuration file provided by “OpenCV”, but
> 
> CMake did not find one.
> 
> Could not find a package configuration file provided by “OpenCV” with any
> 
> of the following names:
> 
> OpenCVConfig.cmake
> 
> opencv-config.cmake
> 
> Add the installation prefix of “OpenCV” to CMAKE\_PREFIX\_PATH or set
> 
> “OpenCV\_DIR” to a directory containing one of the above files. If “OpenCV”
> 
> provides a separate development package or SDK, be sure it has been
> 
> installed.
> 
> Call Stack (most recent call first):
> 
> CMake/ITKModuleEnablement.cmake:374 (include)
> 
> CMakeLists.txt:583 (include)
> 
> **ITKVtkGlue** : need to compile VTK additionally
> 
> **LesionSizingToolkit** ：depend on VTKGlue
> 
> CMake Error at Modules/Bridge/VtkGlue/itk-module-init.cmake:9 (find\_package):
> 
> Could not find a package configuration file provided by “VTK” with any of
> 
> the following names:
> 
> VTKConfig.cmake
> 
> vtk-config.cmake
> 
> Add the installation prefix of “VTK” to CMAKE\_PREFIX\_PATH or set “VTK\_DIR”
> 
> to a directory containing one of the above files. If “VTK” provides a
> 
> separate development package or SDK, be sure it has been installed.
> 
> Call Stack (most recent call first):
> 
> CMake/ITKModuleEnablement.cmake:374 (include)
> 
> CMakeLists.txt:583 (include)
> 
> **SphinxExamples** ：path too long (ITK folder is already in C:\)
> 
> CMake Error at Modules/Remote/SphinxExamples/CMakeLists.txt:65 (message):
> 
> The source directory is currently too long, 40 characters. Please move the
> 
> Examples source directory to a shorter path.
> 
> **CudaCommon** : CUDA environment needed
> 
> CMake Error at Modules/Remote/CudaCommon/src/CMakeLists.txt:12 (target\_link\_libraries):
> 
> Target “CudaCommon” links to:
> 
> CUDA::cudart
> 
> but the target was not found. Possible reasons include:
> 
> \* There is a typo in the target name.
> 
> \* A find\_package call is missing for an IMPORTED target.
> 
> \* An ALIAS target is missing.
> 
> _ **Example and Testing** _
> 
> **IsotropicWavelets\_BUILD\_EXAMPLES:** lack of module
> 
> CMake Error at CMake/ITKModuleAPI.cmake:88 (message):
> 
> No such module: “ITKImageIO”
> 
> Call Stack (most recent call first):
> 
> CMake/ITKModuleAPI.cmake:31 (itk\_module\_load)
> 
> CMake/ITKModuleAPI.cmake:143 (\_itk\_module\_config\_recurse)
> 
> C:/ITK/build/CMakeTmp/ITKConfig.cmake:52 (itk\_module\_config)
> 
> Modules/Remote/IsotropicWavelets/examples/CMakeLists.txt:4 (find\_package)
> 
> **TubeTK\_BUILD\_EXAMPLES:** cannot find package
> 
> CMake Error at Modules/Remote/TubeTK/examples/Applications/CMakeLists.txt:39 (find\_package):
> 
> By not providing “FindSlicerExecutionModel.cmake” in CMAKE\_MODULE\_PATH this
> 
> project has asked CMake to find a package configuration file provided by
> 
> “SlicerExecutionModel”, but CMake did not find one.
> 
> Could not find a package configuration file provided by
> 
> “SlicerExecutionModel” with any of the following names:
> 
> SlicerExecutionModelConfig.cmake
> 
> slicerexecutionmodel-config.cmake
> 
> Add the installation prefix of “SlicerExecutionModel” to CMAKE\_PREFIX\_PATH
> 
> or set “SlicerExecutionModel\_DIR” to a directory containing one of the
> 
> above files. If “SlicerExecutionModel” provides a separate development
> 
> package or SDK, be sure it has been installed.

Thanks for your support.

Cheers,

Rosie

---

<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 26, 2025, 1:27pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/17 "2025-09-26T13:27:31Z")

</div>

> [@Rosie](#):
>
> No such module: “ITKImageIO”

I think this is only available when building the remote module externally, not when building as part of ITK. This is the way to overcome it:

> <https://github.com/InsightSoftwareConsortium/ITKMontage/blob/v0.8.4/examples/CMakeLists.txt#L16-L22>

instead of this:

> <https://github.com/InsightSoftwareConsortium/ITKIsotropicWavelets/blob/v0.6.2/examples/CMakeLists.txt#L4-L13>

A pull request is welcome!

SphinxExamples is rather large, so it is best to build externally (first build ITK without it, then build it pointing to the existing ITK build). These configure-time errors are issued to avoid mysterious build time errors later due to path length limitations.

---

<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 26, 2025, 1:28pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/18 "2025-09-26T13:28:39Z")

</div>

Of course, many remote modules and their examples require some additional libraries, as you have noticed.

---

<div class="post-metadata">

### Author: ![Rosie](https://discourse.itk.org/user_avatar/discourse.itk.org/rosie/32/4585_2.png) [@Rosie](https://discourse.itk.org/u/Rosie)
#### Post date: [September 30, 2025, 7:55am UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/19 "2025-09-30T07:55:32Z")

</div>

Hi **[dzenanz](https://discourse.itk.org/u/dzenanz),**

New errors came.

The first error is for the GoogleTest module. In Cmake gui, I got:

> CMake Error at C:/ITK/build/\_deps/cleaver\_lib-src/src/test/CMakeLists.txt:64 (add\_library): add\_library cannot create imported target “gtest” because another target with the same name already exists.

Therefore, I changed the Cmake file from

> add\_library(${GTEST\_LIBRARY} UNKNOWN IMPORTED)

to

> if(NOT TARGET {GTEST\_LIBRARY}) add\_library({GTEST\_LIBRARY} UNKNOWN IMPORTED)  
> endif()

However, I got

> Cannot open include file: ‘gtest/gtest.h‘: No such file or directory.

during building. I was confused about it.

The second one is errors of CDMTK.

> error: DCMTK was configured to use C++ 11 features, but your compiler does not or was not configured to provide them.

The Visual Studio version is 2022, so it should be C++ 11. I attempted to add the following configuration into CmakeCahe.txt:

> CMAKE\_CXX\_STANDARD=11

But it doesn’t work.

---

<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 30, 2025, 1:20pm UTC](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632/20 "2025-09-30T13:20:47Z")

</div>

Are you using `main` branch or one of the released versions?

[Next page](https://discourse.itk.org/t/would-like-to-compile-the-itk-without-external-third-party-libraries/7632.md?page=2)
