[CMake] CMake and Qt3

olivier.stern at swing.be olivier.stern at swing.be
Tue Jul 19 08:43:47 EDT 2005


Thanks a lot for all your answers,

This way seems to be working and I think now that if it doesn't correctly compile it's because I'm using files made by Qt Designer. Seems like there're modifications to do, I don't really know what for the moment, but I'll try to correct it.

Olivier


----------------------------------------
FIND_PACKAGE(Qt)

ADD_DEFINITIONS(${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

QT_WRAP_CPP(qtwrapping moc_sources essai.h)
QT_WRAP_UI(qtwrapping headers sources essai.ui)
ADD_EXECUTABLE(qtwrapping main.cpp ${moc_sources} ${headers} ${sources})
TARGET_LINK_LIBRARIRES(qtwrapping ${QT_LIBRARIES})

That should do it

On Monday 18 July 2005 23:59, Olivier Stern wrote:
> Hello every one,
>
>
>
> I'm trying to make a CMakeLists.txt file which create a makefile for an
> application using Qt3. I've seen different posts about it and after trying
> everything I come here to ask some help. Here what is done : a simple qt
> application which include 3 files (essai.h essai.ui and main.cpp) and this
> CMakeLists.txt based on the wrapping test :
>
>
>
> SET (QT_WRAP_CPP \"On\")
>
> SET (QT_MOC_EXE \"echo\")
>
>
>
> INCLUDE( ${CMAKE_ROOT}/Modules/FindQt.cmake )
>
>
>
> INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
>
> INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
>
>
>
> SET (QT_WRAP_UI \"On\")
>
> SET (QT_UIC_EXE \"${QT_UIC_EXECUTABLE}\")
>
>
>
> SET (QTUI_SRCS
>
>   essai.ui
>
>   )
>
> QT_WRAP_UI (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})
>
> QT_WRAP_CPP (myqtlib QT_MOC_SRCS ${SRCS} essai.h)
>
>
>
> MESSAGE(\"QT files are ${QTUI_S_SRCS}\")
>
> MESSAGE(\"QT other files are ${QTUI_H_SRCS}\")
>
> ADD_DEFINITIONS(${QT_DEFINITIONS})
>
> ADD_LIBRARY(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})
>
> ADD_EXECUTABLE (qtwrapping main.cpp)
>
> TARGET_LINK_LIBRARIES(qtwrapping myqtlib)
>
> TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} )
>
>
>
> After creating the makefile and compiling the program I have lots of errors
> but all the same type : undefined reference to
>
>
>
> For example the first lines are :
>
> main.o(.text+0x17): In function `main':
> : undefined reference to `QApplication::QApplication(int &, char **)'
>
> main.o(.text+0x80): In function `main':
> : undefined reference to `QApplication::setMainWidget(QWidget *)'
>
> main.o(.text+0xa7): In function `main':
> : undefined reference to `QApplication::exec(void)'
>
> main.o(.text+0xbb): In function `main':
> : undefined reference to `QApplication::~QApplication(void)'
>
> main.o(.text+0xf2): In function `main':
> : undefined reference to `QApplication::~QApplication(void)'
>
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x
>1
>
> 6): In function `essai::findFile(void)':
> : undefined reference to `QString::null'
>
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x
>1
>
> f): In function `essai::findFile(void)':
> : undefined reference to `QString::null'
>
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x
>2
>
> 4): In function `essai::findFile(void)':
> : undefined reference to `QString::null'
>
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x
>2
>
> a): In function `essai::findFile(void)':
> : undefined reference to `QFileDialog::getOpenFileName(QString const &,
>
> QString const &, QWidget *, char const *, QString const &, QString *,
> bool)'
>
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x
>b
>
> d): In function `essai::findDir1(void)':
> : undefined reference to `QString::null'
>
> Thank you for your help,
>
>
>
>             Olivier

-- 
Filipe Sousa


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20050719/e50896ad/attachment.html


More information about the CMake mailing list