<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Yixun,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks a lot for the help. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My problem was that there are multiple ".cxx" files
in the source directory, so I set a source directory in my CMakeLists.txt. I
made a mistake when I included this source directory into the sentence
"ADD_EXECUTABLE( ... )" before. I modified the CMakeLists.txt into the
following, and it works fine now.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>PROJECT( myProject )</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>INCLUDE_REGULAR_EXPRESSION(".*")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>FIND_PACKAGE(ITK)<BR>IF(ITK_FOUND)<BR>
INCLUDE(${ITK_USE_FILE})<BR>ELSE(ITK_FOUND)<BR>
MESSAGE(FATAL_ERROR<BR>
"Cannot build without ITK. Please set
ITK_DIR.")<BR>ENDIF(ITK_FOUND)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>INCLUDE_DIRECTORIES(<BR>${myProject_SOURCE_DIR}<BR>${myProject_BINARY_DIR}<BR>)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>SET(myProject_SRCS<BR>
Registrator.cxx<BR> Optimizer.cxx<BR> Util.cxx<BR>)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>ADD_EXECUTABLE(MarquardtRegistration
myProject_SRCS)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>TARGET_LINK_LIBRARIES(myProject ITKNumerics
ITKBasicFilters ITKIO)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks again.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Ying</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=yxliu@fudan.edu.cn href="mailto:yxliu@fudan.edu.cn">Yixun Liu</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=insight-users@itk.org
href="mailto:insight-users@itk.org">insight-users@itk.org</A> ; <A
title=duying@hotmail.com
href="mailto:duying@hotmail.com">duying@hotmail.com</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, August 03, 2004 7:04
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re:Question on
CMakeLists.txt</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial>Hi,</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>I am not familiar with cmake too, but I use a simple
method which works fine.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>1.set up a new directory and create a cmake file and a
main.cxx(can be empty)</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>2.write the cmake as below:</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial># This project is intended to be built outside the
Insight source tree<BR>PROJECT(myProject)</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial># Find
ITK.<BR>FIND_PACKAGE(ITK)<BR>IF(ITK_FOUND)<BR>
INCLUDE(${ITK_USE_FILE})<BR>ELSE(ITK_FOUND)<BR>
MESSAGE(FATAL_ERROR<BR>
"Cannot build without ITK. Please set
ITK_DIR.")<BR>ENDIF(ITK_FOUND)</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>ADD_EXECUTABLE(myProject main.cxx )</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>TARGET_LINK_LIBRARIES(myProject ITKCommon)</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>3.run CmakeSetup and set the source dir to the
dir including the cmake and the .cxx</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>4.the binary dir can be same as the source, but I
commend you set up another dir.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Hope this helps!</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial>Yixun Liu</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial></FONT> </DIV></BLOCKQUOTE></BODY></HTML>