[CMake] QT_WRAP_UI no generated file Bug or Mistake
Leopold Palomo Avellaneda
leo at alaxarxa.net
Sat Aug 2 07:36:34 EDT 2008
Jan,
I think that you are doing some mistakes.
A Dissabte 02 Agost 2008, Jan Dinger va escriure:
> ###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})
this line is the last.
> 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###
>
.....
> 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....
Here my proposed CMakelist.txt.
###snip###
PROJECT( dummy )
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
FIND_PACKAGE( Qt4 REQUIRED )
if(QT_QTSQL_NOTFOUND)
MESSAGE(FATAL_ERROR "Looking for QtSQL -- not found, this projects needs
QTSQL")
else(QT_QTSQL_NOTFOUND)
MESSAGE(STATUS "Looking for QtSQL -- found")
set(QT_USE_QTSQL TRUE)
endif(QT_QTSQL_NOTFOUND)
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 )
#inportant that this line was created after the QT_USE_XXX
INCLUDE( ${QT_USE_FILE} )
#the place where your .h will be generated
# if you put in a big project several CMakeList
# and for example you have CMakeList in a src/ui
# directory, you will have the .h created by uic
# in build/src/ui
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# generate rules for building source files from the resources
QT4_ADD_RESOURCES( DUMMY_RC_SRCS ${DUMMY_RCS} )
# generate rules for building source files that moc generates
QT4_WRAP_CPP( DUMMY_MOC_SRCS ${DUMMY_MOC_HDRS} )
QT4_WRAP_UI(DUMMY_UIS_HDRS ${DUMMY_UIS} )
ADD_EXECUTABLE( dummy ${DUMMY_SRCS} ${DUMMY_MOC_SRCS} ${DUMMY_RC_SRCS}
${DUMMY_UI_HDRS} )
TARGET_LINK_LIBRARIES( dummy ${QT_LIBRARIES} )
Hope this helps.
Best regards,
Leo
--
--
Linux User 152692
PGP: 0xF944807E
Catalonia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080802/8af12b2e/attachment.pgp>
More information about the CMake
mailing list