Build INSTALL with Visual Studio

I use cmake to create the VS project for building ITK. Until now I’ve been only building the Release libraries, now I want to build and use the Debug libraries as well. It took me a while to realise that when I Build INSTALL, whether Release or Debug the libraries are copied to the specified install directory, with the same names. In other words although the build directory has separate lib\Release and lib\Debug directories containing the two sets of libraries, there is only one install lib directory. Is there a way to get cmake to set up the VS project in a way that will make Build INSTALL create separate Release and Debug lib directories? I am using the cmake GUI.

My ITK build directory is: D:\ITK-VS11-x64-build
the install directory is C:\ITK
Normally I set the environment variable ITK-DIR = C:\ITK.
If I set ITK-DIR = D:\ITK-VS11-x64-build the right libraries are found by VS when I build a program that uses ITK, depending on which build I select. This enables building of either Release or Debug versions of my program, but seems to make the ITK install directory pointless. Am I missing something?

I have a cmake question. I use cmake to create the VS project to build my program, with these lines in CMakeLists.txt:

FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
“ITK not found. Please set ITK_DIR.”)
ENDIF(ITK_FOUND)

How can I tell cmake to use the ITK build directory, without setting ITK_DIR?

Thanks
Gib

Install option is meant for Release or RelWithDebInfo variant, as would be done at some non-developer computer.

As you can have many ITK build directories, and have them anywhere in your directory tree, how could CMake know which one you want? Anyway, I know that CMake picks up as ITK_DIR one of my build trees (not the one I usually want). The point 6 on the search list examines package registry - I suppose I somehow added that ITK build there.

Thanks Dzenan, I’ve been using INSTALL wrongly then. I should always set ITK_DIR to the build directory.

Cheers
Gib

1 Like