Skip to content

Instantly share code, notes, and snippets.

@gavinb
Last active October 19, 2020 06:56
Show Gist options
  • Save gavinb/4c41f0e15b70ccc1e2e4c1e266ebb177 to your computer and use it in GitHub Desktop.
Save gavinb/4c41f0e15b70ccc1e2e4c1e266ebb177 to your computer and use it in GitHub Desktop.
How to use ITK with vcpkg

There is a package for the Insight Toolkit (ITK) v5.1 in the vcpkg tool's ports collection. It installs itself into a folder called ITK-5.1 under the triplet's include folder. However, if you are using the Visual Studio integration (which is very convenient) then this will not work. The headers in ITK do not have a prefix, so they expect to be in the root of a specified include path. The solution is to add it manually, thus:

  • go into the Project Properties' dialog

  • go to the 'C/C++ > General' page

  • edit the 'Additional Include Directories' setting

  • add the following entries to the paths:

      $(VcpkgCurrentInstalledDir)include\ITK-5.1
      $(VcpkgCurrentInstalledDir)include\eigen3
    

The libraries are found automatically (using the pragma trick) and the dependent DLLs are copied into the target folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment