ITK/Configuring and Building/QtCreator
From KitwarePublic
Jump to navigationJump to search
Building ITK through QtCreator using the Visual Studio C++ compiler on Windows 7:
- Launch the CMake GUI from the Visual Studio terminal by going to Start -> Programs -> Visual Studio -> Visual Studio Tools -> Visual Studio Command Prompt and running 'cmake-gui'. It is very important that you do not simply use the CMake GUI shortcut in the start menu, as the environment is not setup properly here.
- Next to "Where is the source code:", click "Browse Source..." and navigate to where you cloned the repository with Git.
- Next to "Where to build the binaries:", select "Browse Build..." and select a place to build the ITK library. I like to use c:\build\ITK. This directory should NOT be inside the directory where you cloned the repository.
- Click "Configure", and then select "NMake Makefiles" as the generator for this project. (Note: this is not a typo: use "NMake Makefiles", not anything that says "Visual Studio")
- Choose your build options. I like to UNCHECK BUILD_EXAMPLES and BUILD_TESTING as they speed up the build process significantly.
- Click "Generate".
- Open QtCreator
- File -> Open Project
- Navigate to the source directory you specified through CMake
- From the Build menu, choose "Build All"
Questions: Sometimes "NMake Generator (Microsoft Visual C++ Compiler 10.0 (x86))" (seems to be with VS2010) is available, while other times it is called "NMake Makefiles" (seems to be with VS2005).
Potential errors: Q: CMake tells you: "To use the NMake generator, cmake must be run from a shell that can use the compiler cl from the command line. This environment does not contain INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to work." A: You probably have run CMake GUI from the normal start menu, rather than launching 'cmake-gui' from the Visual Studio Command Prompt.