[Insight-developers] cmake question

Miller, James V (CRD) millerjv@crd.ge.com
Mon, 4 Mar 2002 08:16:33 -0500


Bill,

Can you put this CMake snippet on the FAQ?

Jim

-----Original Message-----
From: William A. Hoffman [mailto:bill.hoffman@kitware.com]
Sent: Saturday, March 02, 2002 10:49 PM
To: Joshua Cates; Insight-Developers
Subject: Re: [Insight-developers] cmake question


The best way to use ITK is this:

# include module to find itk, this is part of cmake, and
# should work on any machine
INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)

# if itk was found include the use itk file
IF (USE_ITK_FILE)
   INCLUDE(${USE_ITK_FILE})
>LINK_LIBRARIES(
>ITKIO
>ITKBasicFilters
>ITKCommon
>ITKNumerics
>VXLNumerics
>)
>
>ADD_EXECUTABLE(anisodiffuse anisodiffuse)
ENDIF(USE_ITK_FILE)

The link and include directories should be defined for you.
You will however have to specify the LINK_LIBRARIES because we
do not want to force a user to use all the libraries.

-Bill

At 04:49 PM 3/2/2002 -0700, Joshua Cates wrote:
>Hi,
>
>Suppose I want to build an application "anisodiffuse.cxx" outside of the
>Itk source tree.  The following CMakeLists.txt file works:
>
>
>PROJECT(AD)
>
>FIND_PATH(ITK_BINARY_PATH UseITK.cmake /home/cates/itk/Insight-LINUX)
>INCLUDE(/home/cates/itk/Insight-LINUX/UseITK.cmake)
>
>LINK_DIRECTORIES(
>${ITK_BINARY_PATH}/Code/Numerics
>${ITK_BINARY_PATH}/Code/Common
>${ITK_BINARY_PATH}/Code/BasicFilters
>${ITK_BINARY_PATH}/Code/IO
>${ITK_BINARY_PATH}/Code/Numerics/vxl
>)
>
>LINK_LIBRARIES(
>ITKIO
>ITKBasicFilters
>ITKCommon
>ITKNumerics
>VXLNumerics
>)
>
>ADD_EXECUTABLE(anisodiffuse anisodiffuse)
>
>
>
>Is there a way to get rid of the LINK_DIRECTORIES and LINK_LIBRARIES
>definitions?  UseITK.cmake doesn't supply them all.
>
>
>
>Josh.
>
>______________________________
>  Josh Cates
>  School of Computer Science
>  University of Utah
>  Email: cates@cs.utah.edu
>  Phone: (801) 587-7697
>  URL:   www.cs.utk.edu/~cates
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers


_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers