[Insight-developers] LaTeX Tutorial / Examples / CMake
Luis Ibanez
luis.ibanez@kitware.com
Wed, 25 Sep 2002 17:19:51 -0400
Hi,
Following the thread on the reorganization
of the Examples directory.
Here is a sketch of how it will look:
Examples
|-- DataRepresentation
| |-- Image
| | |-- Cxx
| | | `-- Image1.cxx
| | `-- Tcl
| | `-- Image1.tcl
| `-- Mesh
|-- Filtering
|-- GUI
|-- IO
|-- Infrastructure
|-- Installation
|-- Iterators
| `-- Cxx
| |-- CMakeLists.txt
| `-- Iterator1.cxx
|-- Registration
`-- Segmentation
This directories are being referenced
directly form the Latex documents of the
Tutorial. In this way we can make sure
that the code in the document match
exactly the code that is compiled.
The \verbatiminput Latex command is used
to include the source code into Latex
files.
----
Each one of these examples is intended to
be built by itself outside of the ITK tree.
The current minimal CMakeLists.txt file
for each example contains the following:
PROJECT(Image)
INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
IF (USE_ITK_FILE)
INCLUDE(${USE_ITK_FILE})
ENDIF(USE_ITK_FILE)
ADD_EXECUTABLE(Image1 Image1.cxx )
TARGET_LINK_LIBRARIES(Image1 ITKCommon)
Note that lib and include paths are being
sourced directly from the UseITK.cmake list.
This can be configured without using interaction
by invoking cmake and passing the path to the
itk binary dir on the command line. Like:
cmake ~/Tutorial/DataRepresentation/Image/Cxx
-DITK_BINARY_PATH:STRING="/home/ibanez/lib/Insight"
Which is equivalent to run ccmake and interactively
type the path for the ITK binary directory. The advantage
of doing this on the command line is that it will
facilitate to configure a large number of examples from
a script.
--------
In order to be able to build this examples both
as part of the tree and as individual examples,
Andy proposed to add a global cmake variable like
ITK_EXAMPLES_INSIDE
on the top CMakeLists.txt ITK file
Then, the CMakeLists.txt of every example will look like
PROJECT(Image)
IF( ITK_EXAMPLES_INSIDE )
ELSE( ITK_EXAMPLES_INSIDE )
INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
IF (USE_ITK_FILE)
INCLUDE(${USE_ITK_FILE})
ENDIF(USE_ITK_FILE)
ENDIF( ITK_EXAMPLES_INSIDE )
ADD_EXECUTABLE(Image1 Image1.cxx )
TARGET_LINK_LIBRARIES(Image1 ITKCommon)
This will allow to build both as a standalone
project and as a subdir of the ITK tree.
-------
Current directories in Examples will be moved to
a different cvs module, that is a different checkout.
Probably named "InsightApplications". All FLTK based
applications will go there. This will hopefully
simplify the configuration of the ITK kernel.
Luis