[Insight-users] Re: Must I create a CMakeLists.txt file to utilize CMake on a dsw VC project?

Luis Ibanez luis . ibanez at kitware . com
Sun, 31 Aug 2003 10:42:52 -0400


Hi Zhao,

You are not forced to use CMake to configure your ITK-based project. 
However, it is by far the easiest way to do it.

You could configure your project manually by wasting a lot of time
selecting the compiler options, include directories and libraries.
Just to realize at the end that this was the long and painful way
of getting your project configured. That will certainly be a poor
use of your valuable time.

I will strongly suggest you to use CMake for configuring your project.
Please follow the instructions in the SoftwareGuide regarding the
creation of your CMakeLists.txt file.

What aspects of the CMakeLists.txt file did you find troublesome ?
It is only 10 lines of text, and 8 of them are always the same  :-)

> PROJECT(HelloWorld)
> 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(HelloWorld HelloWorld.cxx )
> TARGET_LINK_LIBRARIES(HelloWorld ITKCommon)


Did you work with the example provided in
Insight/Examples/Installation     ?

It is the same described in the software guide in section 2.2.1,
page-pdf 43.

      http://www . itk . org/ItkSoftwareGuide . pdf




Regards,


   Luis



------------------
Zhaocg wrote:
> Hi Luis,
>     I use CMake to custom the ITK source files and compile them with VC. CMake works perfectly. 
>     Now if I create a new VC project and want to use ITK(already compiled, with libs created) with it, can CMake custom the project for me? From itkSoftwareGuid.pdf, it seems that I must write a CMakeLists.txt file. But writing such a file is troublesome :p. Is this the only way to utilize CMake with a VC project?
>     Thanks!
> 
> Best Regards,
> Zhao