[vtkusers] how to setup project for qt

Nick Arini n.arini at btinternet.com
Fri Dec 10 06:51:52 EST 2004


Siyan,

this is really a CMake question. CMake has its own mailing list which you can join here:

http://www.cmake.org/HTML/MailingLists.html

You will need to configure a CMakeLists.txt file which uses Qt and ITK or VTK. I have attached one of mine below which works for me. You will need to use CMake to create a visual studio project which you can then load in the usual way. 


Best regards,

Nick


<begin code>

PROJECT(ImageViewer)

# 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)


#
# Find QT
#
INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)

INCLUDE_DIRECTORIES(
${QT_INCLUDE_DIR}
${QT_INCLUDE_PATH}
)

LINK_LIBRARIES (
${QT_QT_LIBRARY}
)

IF(WIN32)
LINK_LIBRARIES(
${QT_QTMAIN_LIBRARY}
)
ENDIF(WIN32)

IF(WIN32)
ADD_DEFINITIONS(-DQT_DLL)
ENDIF(WIN32)


SET(VIEWER_SRCS
#convertImage.cpp
helpwindow.cpp
ImageScrollView.cpp
ImageViewer.cpp
main.cpp
ScaleDialog.cpp
#scaleImage.cpp
)


SET(VIEWER_MOC_SRCS
BasicDefs.h
#convertImage.h
helpwindow.h
ImageScrollView.h
ImageViewer.h
ScaleDialog.h
#scaleImage.h
)

IF(QT_WRAP_CPP)
QT_WRAP_CPP(viewer VIEWER_SRCS VIEWER_MOC_SRCS)
ENDIF(QT_WRAP_CPP)


#ADD_EXECUTABLE(viewer VIEWER_SRCS)
ADD_EXECUTABLE(viewer WIN32 VIEWER_SRCS)


TARGET_LINK_LIBRARIES(viewer ITKCommon ITKIO)



INSTALL_TARGETS( /bin viewer )


<end code>


siyan liu wrote:

>Hi,all:
>     I want to develop GUI application with QT and ITK on windows, I have installed CMake 2.05 for windows, How can I generate project for QT with Cmake? There is no build for QT option in the "build for" drop listbox, will the "dsw" for vc6 project do, or is there is a cmake version for QT, how can I find it?
>
>     Thanks in advance.
>
>     Regards.  
>
>        siyan liu
>        cncadcam at 163.com
>          2004-12-10
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>





More information about the vtkusers mailing list