[CMake] QT_WRAP_UI no generated file Bug or Mistake

Jan Dinger dinger.jan at googlemail.com
Sat Aug 2 05:23:43 EDT 2008


Hi, folks

Iam using cmake-2.6.0 and there is somthing wrong...

QT_WRAP_UI generates no File, so I can't compile my souce code.

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

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)

#set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )

FIND_PACKAGE( Qt4 REQUIRED )
IF(QT_FOUND)
    INCLUDE(${QT_USE_FILE})
    IF(QT_QTSQL_FOUND)
        INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR})
    ELSE(QT_QTSQL_FOUND)
        MESSAGE(FATAL ERROR "Qt SQL libraries missing.")
    ENDIF(QT_QTSQL_FOUND)
    ELSE(QT_FOUND)
        MESSAGE(FATAL ERROR "Qt4 not found.")
ENDIF(QT_FOUND)


SET( DUMMY_SRCS
    ./src/main.cpp
    ./src/logindialog/logindialog.cpp
    ./src/mainwindow/mainwindow.cpp
)

SET( DUMMY_MOC_HDRS
    ./src/logindialog/logindialog.h
    ./src/mainwindow/mainwindow.h
)

SET( DUMMY_UIS
    ./ui/logindialog.ui
    ./ui/mainwindow.ui
)

SET( DUMMY_RCS
    ./images/dummy.qrc
)

ADD_DEFINITIONS( -Wall )

SET( QT_USE_QTSQL TRUE )

QT4_ADD_RESOURCES( DUMMY_RC_SRCS ${DUMMY_RCS} )

IF(QT_WRAP_CPP)
     IF (QT_WRAP_UI)
         QT4_WRAP_UI(DUMMY_UIS_HDRS ${DUMMY_UIS} )
        QT4_WRAP_CPP( DUMMY_MOC_SRCS ${DUMMY_MOC_HDRS} )
    ENDIF (QT_WRAP_UI)
ENDIF(QT_WRAP_CPP)

INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )

ADD_EXECUTABLE( dummy ${DUMMY_SRCS} ${DUMMY_MOC_SRCS} ${DUMMY_RC_SRCS}
${DUMMY_UI_HDRS} )

TARGET_LINK_LIBRARIES( dummy ${QT_LIBRARIES} ${QT_QTSQL_LIBRARIES} )

###snap###

Here is my compile process:

###snip###
[ 11%] Generating qrc_dummy.cxx
[ 22%] Generating src/logindialog/moc_logindialog.cxx
[ 33%] Generating src/mainwindow/moc_mainwindow.cxx
Scanning dependencies of target dummy
[ 44%] Building CXX object CMakeFiles/dummy.dir/src/main.cpp.o
In file included from /home/jan/workspace/cpp/dummy/src/main.cpp:4:
/home/jan/workspace/cpp/dummy/src/mainwindow/mainwindow.h:3:39: error:
../../build/ui_mainwindow.h: No such file or directory
In file included from /home/jan/workspace/cpp/dummy/src/main.cpp:5:
/home/jan/workspace/cpp/dummy/src/logindialog/logindialog.h:5:40: error:
../../build/ui_logindialog.h: No such file or directory
In file included from /home/jan/workspace/cpp/dummy/src/main.cpp:4:
/home/jan/workspace/cpp/dummy/src/mainwindow/mainwindow.h:5: error: 'Ui' has
not been declared
/home/jan/workspace/cpp/dummy/src/mainwindow/mainwindow.h:5: error: expected
`{' before 'mainwindow'
/home/jan/workspace/cpp/dummy/src/mainwindow/mainwindow.h:5: error: function
definition does not declare parameters
In file included from /home/jan/workspace/cpp/dummy/src/main.cpp:5:
/home/jan/workspace/cpp/dummy/src/logindialog/logindialog.h:7: error: 'Ui'
has not been declared
/home/jan/workspace/cpp/dummy/src/logindialog/logindialog.h:7: error:
expected `{' before 'logindialog'
/home/jan/workspace/cpp/dummy/src/logindialog/logindialog.h:7: error:
function definition does not declare parameters
/home/jan/workspace/cpp/dummy/src/main.cpp: In function 'int main(int,
char**)':
/home/jan/workspace/cpp/dummy/src/main.cpp:17: error: aggregate
'CLoginDialog logindialog' has incomplete type and cannot be defined
/home/jan/workspace/cpp/dummy/src/main.cpp:18: error: aggregate 'CMainWindow
window' has incomplete type and cannot be defined
/home/jan/workspace/cpp/dummy/src/main.cpp:19: error: incomplete type
'CLoginDialog' used in nested name specifier
make[2]: *** [CMakeFiles/dummy.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/dummy.dir/all] Error 2
make: *** [all] Error 2
###snap###

The error is correct, I can't compile without any ui_xxx.h files. So whats
is wrong with my CMakeLists.txt

I hope someone has a little bit time to help me.

I hope it is my mistake and no bug....

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


More information about the CMake mailing list