[CMake] using Qt 4 resources with cmake and RCC ?

dwikler at skynet.be dwikler at skynet.be
Sat Mar 25 12:33:07 EST 2006


Dear All,

I am a newbie to Qt 4 and I try to use CMake instead of qmake because I 
also use ITK. I was not able to get RCC working with CMake though I have 
seen in the FindQt4.cmake that it is supported.
I added QT4_ADD_RESOURCES in my CMakeLists.txt but the .qrc file is not
processed by RCC, and I get the following error at link:

main.cxx:(.text+0x1e): undefined reference to `qInitResources_application()'

related to the  Q_INIT_RESOURCE(application); line I added in my 
main.cxx file as  described in the Qt documentation.

Does somebody know how to do ?

Thank you all.

David

Here is my CMakeLists.txt: (I am using CMake 2.2 Patch 2)

PROJECT( QtApp )

INCLUDE (${CMAKE_ROOT}/Modules/FindITK.cmake)
IF ( USE_ITK_FILE )
         INCLUDE(${USE_ITK_FILE})
ENDIF( USE_ITK_FILE )

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

INCLUDE(   ${QT_USE_FILE}   )

SET(QtApp_SRCS main.cxx mainwindow.cxx)
SET(QtApp_MOC_SRCS mainwindow.h)
SET(QtApp_RCC_SRCS application.qrc)

QT4_ADD_RESOURCES(application ${QtApp_RCC_SRCS})

QT_WRAP_CPP(QtApp QtApp_SRCS ${QtApp_MOC_SRCS})

ADD_EXECUTABLE(  QtApp ${QtApp_SRCS})

TARGET_LINK_LIBRARIES ( QtApp ${QT_LIBRARIES}  )

 
David Wikler
ULB
Brussels, Belgium



More information about the CMake mailing list