PDA

View Full Version : QResource + CMAKE



lhdamiani
7th August 2013, 20:09
Hello,

I'm trying to use Qt Resources but my project i work with uses Cmakes files instead of pro files. I'm facing troubles to include de resources files and be able to use them.

What i'm trying is to add the following into my cmakeslists file


Part of my cmakeslists.txt
.
..
...
SET( RESOURCES resources.qrc )

QT4_ADD_RESOURCES(QtApp_RCC_SRCS ${RESOURCES})

...
...

target_link_libraries(
dominio
${QT_LIBRARIES}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QtApp_RCC_SRCS}
)

...
..
.


It appears on the project viewer, i can add/remove/modify but i never get to compile it. The error returned is:

*** No rule to make target `Domain/qrc_resources.cxx', needed by `Domain/libdominio_d.dll'.

Can anyone help me on this one?

Thanks in advance!

Leonardo

ChrisW67
8th August 2013, 01:29
After QT4_ADD_RESOURCES() is done with it the QtApp_RCC_SRCS variable contains a list of source files not libraries. You need to add this list of source files to your executable not the linker library list.


...
QT4_ADD_RESOURCES(QtApp_RCC_SRCS ${RESOURCES})
...
add_executable(QtApp ${QtApp_SRCS} ${QtApp_MOC_SRCS} ${QtApp_RCC_SRCS} ${QtApp_UI_HDRS} )