[Insight-users] ITK Qt: no moc_files generated

Christian Marshall Rieck rieck at stud.ntnu.no
Thu Mar 1 04:53:23 EST 2007


> After successfully combining VTK and Qt3 I tried unsuccessfully with ITK and 
> Qt3. Using the example from a brand new Insight applications with a cvs 
> version of ITK and cmake  version 2.4-patch 3, I get link errors. I have 
> traced them to the fact, that QT_WRAP_CPP(QtITK ${QtITK_SRCS} 
> ${QtITK_MOC_SRCS})
> does not seem to be doing anything. The variable ${QtITK_SRCS} is the same as 
> before and no moc_files are generated.
> 
> Chetan Bhole reported this before (Oct 15) on a Windows machine and mine is 
> running Linux. Can anybody point me in the right direction, please?

I use qt4 with itk, and it works. below is my cmakelists, maybe it will 
help. (i also had problems getting it to work. try googling the 
insight-users mailing list history)

PROJECT(Test)

FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
    MESSAGE(FATAL_ERROR "ITK NOT FOUND --C")
ENDIF(ITK_FOUND)

FIND_PACKAGE(Qt)
IF(QT_USE_FILE)
  SET(QT_USE_QT3SUPPORT TRUE)
  INCLUDE(${QT_USE_FILE})
ELSE(QT_USE_FILE)
  SET(QT_LIBRARIES   ${QT_QT_LIBRARY})
ENDIF(QT_USE_FILE)


INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )

LINK_LIBRARIES(${QT_LIBRARIES})

#make an executable from the cpp-files in QT_SRCS
SET(QT_SRCS 
	.cpp-s
)

SET(QT_HDRS
	header-files..
)

#header that needs "moc-ing"
SET(cqtlib_MOC_HDRS 
	PLogic.h
)


QT4_WRAP_CPP(cqtlib_MOC_SRC ${cqtlib_MOC_HDRS})

SET(cqtlib_SRCS
	${cqtlib_MOC_SRC}
	PLogic.cpp
)

#creates cqtlib_MOC_SRC = moc_Class1.cxx etc
ADD_EXECUTABLE(Segmentation ${cqtlib_SRCS} ${QT_SRCS} ${QT_HDRS})

ADD_LIBRARY(Segmentation SHARED ${cqtlib_SRCS} ${cqtlib_MOC_HDRS})

#link against qt-libraries
TARGET_LINK_LIBRARIES(Segmentation ${QT_LIBRARIES} ITKIO ITKCommon 
ITKBasicFilters)



Christian.


More information about the Insight-users mailing list