[Insight-users] Simple CMakeList.txt

Mathieu Lamard Mathieu.Lamard@enst-bretagne.fr
Thu, 07 Nov 2002 09:55:15 +0100


Thanks Brad for your rapid answer,


here is my new CMakeList.txt (I use now the CVS version of CMake, 
because this CMakeList is doing a segmentation fault with CMake 1.4.6)


PROJECT(Echolyse2)

FIND_PATH(ITK_DIR ITKConfig.cmake)
IF(ITK_DIR)
   INCLUDE(${ITK_DIR}/ITKConfig.cmake)
   SET(ITK_FOUND 1)
ELSE(ITK_DIR)
   MESSAGE("ITK not found.  Set ITK_DIR to the location of 
ITKConfig.cmake.")
ENDIF(ITK_DIR)


IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)

INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)


SOURCE_FILES(Echolyse_SRCS
Vasculaire
Algorithm
Contour
GateWay
Echolyse2
Echolyse2-Vasculaire
main
)

SOURCE_FILES(Echolyse_GUI_SRCS
Echolyse2GUI.fl
)

ADD_EXECUTABLE(Echolyse2-exe ${Echolyse_SRCS})
TARGET_LINK_LIBRARIES(Echolyse2-exe ${ITK_LIBRARIES})
FLTK_WRAP_UI(Echolyse2-exe ${Echolyse_GUI_SRCS})


But the problem now is that VTK is not present in the Makefile

I test without success


INCLUDE (${ITK_DIR}/Utilities/ITKFindVTK.cmake)
or / and
INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)

Have you an idea ?

Mathieu


Brad King wrote:
> Mathieu,
> 
> 
>>INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
>>IF (  USE_ITK_FILE  )
>>          INCLUDE(  ${USE_ITK_FILE}  )
>>ENDIF(   USE_ITK_FILE   )
> 
> 
> This is all you need to use ITK, the ITK_DIR stuff is the alternative.
> You can use the lines below INSTEAD of (not with) the lines above.  The
> difference is that the code below will support using ITK from an
> installation tree separate from the build tree.
> 
> # This part will be most of the implementation of the FindITK.cmake module
> # in the next version of CMake.
> FIND_PATH(ITK_DIR ITKConfig.cmake)
> IF(ITK_DIR)
>   INCLUDE(${ITK_DIR}/ITKConfig.cmake)
>   SET(ITK_FOUND 1)
> ELSE(ITK_DIR)
>   MESSAGE("ITK not found.  Set ITK_DIR to the location of ITKConfig.cmake.")
> ENDIF(ITK_DIR)
> 
> # This part actually brings in the include directories, link
> # directories, and preprocessor definitions needed to use ITK.
> # One may optionally write INSTEAD the
> #   INCLUDE_DIRECTORIES(${ITK_INCLUDE_DIRS})
> #   LINK_DIRECTORIES(${ITK_LIBRARY_DIRS})
> #   ADD_DEFINITIONS(${ITK_DEFINITIONS})
> # lines by hand to get more fine-grained control, but it will not
> # automatically enforce that your compiler matches ITK's compiler.
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
> 
> 
>>INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)
>>IF (   USE_FLTK_FILE   )
>>          INCLUDE(  ${USE_FLTK_FILE}  )
>>ENDIF(   USE_FLTK_FILE   )
> 
> 
> This should be simply
> 
>   INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)
> 
> because there is no "use" file for FLTK.  It is not a CMake project.
> 
> 
>>TARGET_LINK_LIBRARIES((Echolyse2-exe ${ITK_LIBRARIES})
>>
>>ADD_EXECUTABLE(Echolyse2-exe Echolyse_SRCS)
>>
>>FLTK_WRAP_UI(Echolyse2-exe Echolyse_GUI_SRCS)
> 
> 
> TARGET_LINK_LIBRARIES needs to be after the ADD_EXECUTABLE because the
> target must exist before it can be told how to link.  These lines should
> be:
> 
> ADD_EXECUTABLE(Echolyse2-exe ${Echolyse_SRCS})
> TARGET_LINK_LIBRARIES(Echolyse2-exe ${ITK_LIBRARIES})
> FLTK_WRAP_UI(Echolyse2-exe ${Echolyse_GUI_SRCS})
> 
> or, if you know specifically what ITK libraries you want, you can use a
> command like
> 
> TARGET_LINK_LIBRARIES(Echolyse2-exe ITKCommon ITKAlgorithms)
> 
> Sorry for all the confusion in the build process.  ITK and CMake have been
> under very rapid development.
> 
> -Brad
> 
> 
>