[CMake] Qt-Sources and non Qt-Source

Jan Dinger dinger.jan at googlemail.com
Tue Aug 12 11:24:47 EDT 2008


Hello folks,

I've a CMakeLists.txt, this file works fine. Now I've added a small wrapper,
this wrapper is no Qt-Code (no Q_OBJECT flag). How can I merge this in my
CMakeLists.txt?

make crashes with the this error:
### snip ###
make[2]: *** No rule to make target `../.src/xmlhandler/xmlhandler.h',
needed by `.src/xmlhandler/moc_xmlhandler.cxx'.  Stop.
make[1]: *** [CMakeFiles/autoluncher.dir/all] Error 2
make: *** [all] Error 2
### snap ###

xmlhandler.h is plain c++

How can I integrate it in my CMakeLists.txt?

Here is my CMakeLists.txt
### snip ###
PROJECT( autoluncher )

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)

FIND_PACKAGE( Qt4 REQUIRED )

SET( AUTOLUNCHER_SRCS
    ./src/main.cpp
    ./src/mainwindow/mainwindow.cpp
    ./src/xmlhandler/xmlhandler.cpp
)

SET( AUTOLUNCHER_MOC_HDRS
    ./src/mainwindow/mainwindow.h
    .src/xmlhandler/xmlhandler.h
)

SET( AUTOLUNCHER_UIS
    ./ui/mainwindow.ui
)

SET( AUTOLUNCHER_RCS
    ./images/autoluncher.qrc
)

ADD_DEFINITIONS( -Wall )

INCLUDE( ${QT_USE_FILE} )

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

QT4_ADD_RESOURCES( AUTOLUNCHER_RC_SRCS ${AUTOLUNCHER_RCS} )

QT4_WRAP_CPP( AUTOLUNCHER_MOC_SRCS ${AUTOLUNCHER_MOC_HDRS} )

QT4_WRAP_UI(AUTOLUNCHER_UIS_HDRS ${AUTOLUNCHER_UIS} )

ADD_EXECUTABLE( autoluncher ${AUTOLUNCHER_SRCS} ${AUTOLUNCHER_MOC_SRCS}
${AUTOLUNCHER_RC_SRCS} ${AUTOLUNCHER_UIS_HDRS} )

TARGET_LINK_LIBRARIES( autoluncher ${QT_LIBRARIES} )
### snap ###

Thanks for help

so long
jd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080812/145abf25/attachment.htm>


More information about the CMake mailing list