I am a casual user of ITK, and haven’t used it in a few years. When I recently set it up again, I found that the original CMakelists.txt file I had previously used didn’t work any more in CMake. This is a small example program and only had 1 CMakelists file. I did get an error relating to the version requirement and fixed that. The file contents are here:
Can anyone suggest changes/additions that would let this work? Is there some help somewhere that will help with this? I have been looking but haven’t been able to find anything.
Yes I did forget that. Turns out I did figure out the issue, I had to set some system variables (ITK_DIR and VTK_DIR). Once I did that, the problem went away. However, I have a new problem in that the linker won’t link my program because of the names assigned to the libraries don’t match the names that are assigned in the project. I am using Visual C++ 2026, and in the linker settings I see all of the ITK files listed as, for example, itkdouble-conversion.lib. This is the first file and the error occurs listing this file, though all of the rest have the same issue. In the ITK build directory, the file is listed as itkdouble-conversion-5.4.lib. I assume there is a setting in CMake, either in the ITK build or in my program that is causing this. I am looking for this issue, but will be happy to hear any suggestions. Thanks for your help!
BUILD_STATIC_LIBS is the usual, default, widely tested setting. ITK compiles with VS2026, and should generally work fine. Can you try a clean build of your project (choose a new, empty folder as the build directory)? If it fails, provide the complete configure and build logs.
It works now with a rebuild of my application. Thanks so much for your help.
One more question: Is there a resource somewhere that explains the cmakelists.txt file for ITK and VTK? I have always struggled with this aspect of writing ITK and VTK code.