[Insight-users] MFC + ITK + VTK + CMake
Luis Ibanez
luis.ibanez@kitware.com
Wed, 05 Mar 2003 11:45:59 -0500
Hi Zhao,
In order to use MFC in your project you just
need to add the following lines to the
CMakeLists.txt file:
ADD_DEFINITIONS(-D_AFXDLL)
SET(CMAKE_MFC_FLAG 6)
Also, make sure that you add the file
StdAfx.cpp
to the list of sources,
like for example:
SET( SRCS
mySourceFile1.pp
mySourceFile2.pp
mySourceFile3.pp
StdAfx.cpp
)
ADD_EXECUTABLE(MyExecutable WIN32 ${SRCS} )
---------------
For using ITK you need to add
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build InsightApplications without ITK. Please set
ITK_DIR.")
ENDIF(ITK_FOUND)
---------------
For using VTK you need to add
FIND_PACKAGE(VTK)
IF (VTK_FOUND)
INCLUDE (${VTK_USE_FILE})
ELSE(VTK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build InsightApplications without ITK. Please set
VTK_DIR.")
ENDIF(VTK_FOUND)
-----------------
About your first question:
The project generated by CMake will be better than the
one you can generate manually from the VisualStudio GUI
because:
1) It will be consistant
2) It will be reproducible
3) It will be portable
4) It will be readable
Trying to configure by hand a project is simply a waste
of time. Using CMake you should be up and running in less
than an hour.
Please let us know if you encounter any problem.
Thanks
Luis
-------------------------------------
zhao yong qiang wrote:
> Hi Luis,
> two questions:
> 1.you told me no matter what compiler i use, i need to use CMake.but when i use MSVC, it helps us to build a project. do this project and the project built by CMake have difference? if they do, what difference?
> 2. In MSVC, how to combine MFC and ITK class? and how i combine VTK and ITK to run effectively ?
>
> Thanks a lot!!!
>
> Regards,
> Zhao Yongqiang
> Dept. of Computer Science & Engineering
> Shanghai JiaoTong University
> Shanghai, China
> zhao-yq@cs.sjtu.edu.cn