Hi everyone,
I'm using "Visual Studio 8 (2005) C++ with Qt4 integration" (MSVS/QT IDE) on a
Windows XP platform. I started creating my application in the standard way with
<File><New><Project><Qt application>. This gives me Qt Designer support that
creates and/or shows the accompanying source when a double click on a widget.
It is possible to right-click on a widget and select "Connect signal..." to
create the source code for that specific signal.
Now I'm trying to use CMake to create a solution file that gives me the same
behavior in my MSVS/QT IDE. At this stage compiling and linking is ok, so the
program works. However, when using the integrated Qt Designer to edit UI files,
double-clicking on a widget does not create or show me the accompanying source
code. It is possible to right-click on a widget and select "Connect signal..."
but again no code is shown or generated in the accompanying H and CPP files.
Does anybody know what attributes I should add to my CMakeLists.txt file to
include source code generation in my IDE?
Any help will be much appreciated!
Iwan Dobbe
cmake_minimum_required(VERSION 2.6)
# -------------------------------- Project name
---------------------------------
PROJECT(Virtomy)
# --------------- Find VTK toolkit and incorporate into project
------------------
FIND_PACKAGE(VTK)
IF(NOT VTK_DIR)
MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
ENDIF(NOT VTK_DIR)
INCLUDE(${VTK_USE_FILE})
# --------------- Find Insight toolkit and incorporate into the project
----------
# FIND_PACKAGE(ITK)
# IF(NOT ITK_FOUND)
# MESSAGE(FATAL_ERROR "Please set ITK_DIR.")
# ENDIF(ITK_FOUND)
# INCLUDE(FATAL_ERROR ${ITK_USE_FILE})
# --------------- Find Qt toolkit and incorporate into the project
---------------
FIND_PACKAGE(Qt4)
SET(QT_USE_QTXML 1)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(
${QT_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
# Generate list (PrgResourceFiles) of resource files:
FILE(GLOB PrgResourceFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qrc)
# Add list of resource files:
QT4_ADD_RESOURCES(PrgResources ${PrgResourceFiles} )
# Generate list (PrgSourceFiles) of c++ source files:
FILE(GLOB PrgSourceFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
# Generate list (UIFiles) of User Interface Forms:
FILE(GLOB UIFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ui)
# Generate UIs:
QT4_WRAP_UI(UIs ${UIFiles})
# Generate list (PrgHeaderFiles) of header files:
FILE(GLOB PrgHeaderFiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
# Create MOC code from list of files:
QT4_WRAP_CPP(MOCSources ${PrgHeaderFiles} )
ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_CORE_LIB)
SET_SOURCE_FILES_PROPERTIES(${PrgSourceFiles} PROPERTIES OBJECT_DEPENDS
"${UIs}")
# ------------------ Add executable with specified source files
------------------
ADD_EXECUTABLE( Virtomy
${PrgSourceFiles}
${PrgHeaderFiles}
${MOCSources}
${UIs}
${PrgResources}
)
# ---------------------- Link exe with the following libraries
-------------------
TARGET_LINK_LIBRARIES( Virtomy
QVTK
${QT_LIBRARIES}
vtkCommon
vtkDicomParser
vtkexoIIc
vtkexpat
vtkFiltering
vtkfreetype
vtkftgl
vtkGenericFiltering
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkjpeg
vtkNetCDF
vtkpng
vtkRendering
vtksys
vtktiff
vtkVolumeRendering
vtkWidgets
vtkzlib
vtkGraphics
vtkIO
vtkCommon
)
#
--------------------------------------------------------------------------------
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake