[vtkusers] Using Cmake to compile programs that use QVTK

Clinton Stimpson clinton at elemtech.com
Mon May 28 21:59:58 EDT 2007


> Hi all,
>
> Is there a way to create the CMakeLists.txt file automatically? Or can
> someone please provide a template file that I could use to compile programs
> that use QVTKWidget.
> I'm using Qt 4.2.3 and VTK 5.0.3.
>
> Thanks for any help!
>
> Shriram
>   

Here's a simple Qt4 example you can start with.  There's more examples 
in VTK/Examples/GUI/Qt
The examples could be simplified a bit if you were targeting a specific 
Qt version.

Clint

=== CMakeLists.txt ==============

FIND_PACKAGE(VTK)
IF(VTK_FOUND)
  # Use Qt that the QVTK library was built with
  SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
  SET(DESIRED_QT_VERSION ${VTK_DESIRED_QT_VERSION} CACHE FILEPATH "")
  FIND_PACKAGE(Qt4)
ENDIF(VTK_FOUND)

IF(VTK_FOUND AND QT_FOUND)
  INCLUDE(${VTK_USE_FILE})
  INCLUDE(${QT_USE_FILE})
  ADD_EXECUTABLE(myqtvtkapp main.cxx)
  TARGET_LINK_LIBRARIES(myqtvtkapp QVTK vtkRendering ${QT_LIBRARIES} )
ENDIF(VTK_FOUND AND QT_FOUND)

=================




More information about the vtkusers mailing list