[Insight-users] Re:Question on CMakeLists.txt

Yixun Liu yxliu at fudan.edu.cn
Tue Aug 3 09:04:04 EDT 2004


Hi,

I am not familiar with cmake too, but I use a simple method which works fine.

1.set up a new directory and create a cmake file and a main.cxx(can be empty)

2.write the cmake as below:

# This project is intended to be built outside the Insight source tree
PROJECT(myProject)

# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)

ADD_EXECUTABLE(myProject main.cxx )

TARGET_LINK_LIBRARIES(myProject ITKCommon)

3.run CmakeSetup and set the source dir to the dir including the cmake and the .cxx

4.the binary dir can be same as the source, but I commend you set up another dir.

Hope this helps!

Yixun Liu





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040803/37764489/attachment.html


More information about the Insight-users mailing list