[Cmake] CMakeLists.txt for Qt project: QT_WRAP_UI problem??

Steve Boyd skboyd at ucalgary . ca
Thu, 10 Jul 2003 14:24:29 -0700


Hi,

I've been trying to build my Qt/VTK project with CMake, and carefully
following previous e-mails
(http://www . cmake . org/pipermail/cmake/2003-April/001526 . html).

I get the following error: "No rule to make target
'/visualization_tool.cxx' needed by 'cmake.check_depends'.

I think I'm not using QT_WRAP_UI correctly, but I'm not sure.  Would
somebody please suggest a correction to my CMakeLists.txt file that may
solve the problem?

I'm using CMake 1.6.7, linux redhat 9, vtk 4.2.1 and Qt 3.1.

The files in my directory are:

            main.cpp (.h)
            visRenderEngine.cpp (.h)
            visWindow.cpp (.h)
            visModel.cpp (.h)
            visAimModel.cpp (.h)
            visStreamComponent.cpp(.h)

            visualization_tool.ui

Also, CMake complains that QT_DIR is not found, and suggests I set that
variable to "The directory containing QTConfig.cmake".  Although I
haven't set that variable I have been able to successfully build the
vtk_qt package by Kuebler.  Perhaps that variable isn't important unless
I'm building with .ui files (Kuebler's package has no .ui files).  What
should QT_DIR be set to??

Thanks,

Steve

CMakeLists.txt
------------------------------------------------------------------------------

PROJECT(vis)

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

INCLUDE_DIRECTORIES(
  ${VTKMY_SOURCE_DIR}/Utilities/vtk_qt
  ${QT_INCLUDE_DIR}
  ${QT_INCLUDE_PATH}
)

LINK_LIBRARIES (
  vtk_qt

  vtkRendering
  vtkGraphics	  
  vtkHybrid	  
  vtkImaging
  vtkIO
  vtkFiltering
  vtkCommon
  vtkzlib

  ${QT_QT_LIBRARY}
)

ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_DEFINITIONS(-DQT_DLL) 

IF (QT_WRAP_CPP)
  IF (QT_WRAP_UI)

  SET(vis_SRCS
            main.cpp 
            visRenderEngine.cpp
            visWindow.cpp 
            visModel.cpp 
            visAimModel.cpp 
            visStreamComponent.cpp
  )

  SET(vis_UI
            visualization_tool.ui
  )

# No MOC classes...
  SET(vis_MOC_CLASSES
#            main.h
#            visRenderEngine.h
#            visWindow.h
#            visModel.h 
#            visAimModel.h 
#            visStreamComponent.h
  )

  QT_WRAP_UI(vis vis_UI_HDRS vis_UI_SRCS vis_UI)
  
  QT_WRAP_CPP(vis vis_MOC_FILES vis_MOC_CLASSES)
  
  ADD_EXECUTABLE(AppVis vis_SRCS vis_UI_SRCS vis_MOC_FILES)

  ENDIF (QT_WRAP_UI)
ENDIF (QT_WRAP_CPP)

INSTALL_TARGETS(/bin AppVis)


-- 
Steven Boyd, PhD

Assistant Professor
Department of Mechanical and Manufacturing Engineering
University of Calgary
2500 University Drive, N.W.
Calgary, Alberta, Canada, T2N 1N4

tel. 1.403.220.4173  fax. 1.403.282.8406  skboyd at ucalgary . ca
-------------------------------------------------------------------