[Insight-developers] Sample Insight project that builds outside of the Insight source tree

Miller, James V (CRD) millerjv@crd.ge.com
Thu, 24 May 2001 22:55:43 -0400

I checked in a project (Insight/Examples/SampleProject) that can be built outside of Insight's source
tree using CMake. Currently, it only supports Windows. I have not grokked how to set up a Unix build
like this yet (I think I need a small configure script).

To use this project:

Copy the SampleProject to somewhere outside of your Insight source tree. Run a copy of CMakeSetup.
The copy from Insight will work fine if you've updated CMake today or yesterday.  (When you run
Insight's version of CMakeSetup, it will show the values from Insight (from your last build).  Once
you change the source directory and build directory to SampleProject, those values will be replaced.)
Set the source directory to SampleProject and the binary project to SampleProject-vc. When you build
the project files, only three or four cache values will appear.   The ITK_BINARY_DIR will be
NOTFOUND.  Change this cache value to point to your Insight build tree. Rebuild the project files.
All the cached values from your Insight build configuration will now appear.

You can now load SampleProject-vc/SampleProject.dsw into Visual Studio and build it.

For the interested:

I broke Insight's CMakeLists.txt file into two files.  The second file is itkCMakeOptions.cmake.
This file has the include and link directories. SampleProject's CMakeLists.txt file loads
itkCMakeOptions.cmake as well as itk's CMakeCache.  Thus, SampleProject will build with all the same
options as Insight was built with.

Note: don't be tempted to modify the cache values loaded into SampleProject from Insight.  Your edits
will be lost once the project file is built.  On building the project files, Insight's cache is
reloaded into SampleProject to ensure that SampleProject builds with all the same options as Insight.