Then you must have a static build of Qt? If you use CMake 2.6.0 or greater, it should work with a static Qt.
Clint On Friday 26 September 2008 1:22:54 pm Linge Bai wrote: > I still have the same problems: > [15:20:04] ~/Desktop/myQt/hellogl$ > cmake . > -- Found Qt-Version 4.4.2 > -- Configuring done > -- Generating done > -- Build files have been written to: /Users/lb353/Desktop/myQt/hellogl > [15:20:08] ~/Desktop/myQt/hellogl$ > make > Scanning dependencies of target exe > [ 33%] Building CXX object CMakeFiles/exe.dir/main.o > [ 66%] Building CXX object CMakeFiles/exe.dir/glwidget.o > [100%] Building CXX object CMakeFiles/exe.dir/window.o > Linking CXX executable exe > Undefined symbols: > "_glEnable", referenced from: > GLWidget::initializeGL() in glwidget.o > GLWidget::initializeGL() in glwidget.o > "_glEnd", referenced from: > GLWidget::makeObject() in glwidget.o > "_glGenLists", referenced from: > GLWidget::makeObject() in glwidget.o > "_glMatrixMode", referenced from: > GLWidget::resizeGL(int, int)in glwidget.o > GLWidget::resizeGL(int, int)in glwidget.o > "_glEndList", referenced from: > GLWidget::makeObject() in glwidget.o > "GLWidget::zRotationChanged(int)", referenced from: > GLWidget::setZRotation(int) in glwidget.o > "_glRotated", referenced from: > GLWidget::paintGL() in glwidget.o > GLWidget::paintGL() in glwidget.o > GLWidget::paintGL() in glwidget.o > "_glCallList", referenced from: > GLWidget::paintGL() in glwidget.o > "GLWidget::xRotationChanged(int)", referenced from: > GLWidget::setXRotation(int) in glwidget.o > "_glViewport", referenced from: > GLWidget::resizeGL(int, int)in glwidget.o > "_glDeleteLists", referenced from: > GLWidget::~GLWidget()in glwidget.o > GLWidget::~GLWidget()in glwidget.o > GLWidget::~GLWidget()in glwidget.o > "GLWidget::yRotationChanged(int)", referenced from: > GLWidget::setYRotation(int) in glwidget.o > "_glBegin", referenced from: > GLWidget::makeObject() in glwidget.o > "_glNewList", referenced from: > GLWidget::makeObject() in glwidget.o > "_glVertex3d", referenced from: > GLWidget::extrude(double, double, double, double)in glwidget.o > GLWidget::extrude(double, double, double, double)in glwidget.o > GLWidget::extrude(double, double, double, double)in glwidget.o > GLWidget::extrude(double, double, double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > GLWidget::quad(double, double, double, double, double, double, > double, double)in glwidget.o > "vtable for Window", referenced from: > __ZTV6Window$non_lazy_ptr in main.o > __ZTV6Window$non_lazy_ptr in window.o > "Window::staticMetaObject", referenced from: > __ZN6Window16staticMetaObjectE$non_lazy_ptr in window.o > "_glOrtho", referenced from: > GLWidget::resizeGL(int, int)in glwidget.o > "_glLoadIdentity", referenced from: > GLWidget::paintGL() in glwidget.o > GLWidget::resizeGL(int, int)in glwidget.o > "_glClear", referenced from: > GLWidget::paintGL() in glwidget.o > "vtable for GLWidget", referenced from: > __ZTV8GLWidget$non_lazy_ptr in glwidget.o > "_glShadeModel", referenced from: > GLWidget::initializeGL() in glwidget.o > "_glTranslated", referenced from: > GLWidget::paintGL() in glwidget.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[2]: *** [exe] Error 1 > make[1]: *** [CMakeFiles/exe.dir/all] Error 2 > make: *** [all] Error 2 > > I've also attached the source files, which are really simple Qt files if > you are interested. Thank you very much for your reply. > > Linge > > On Fri, Sep 26, 2008 at 3:15 PM, <[EMAIL PROTECTED]> wrote: > > It should simply be: > > > > PROJECT ( COMBINED ) > > FIND_PACKAGE (Qt4 REQUIRED) > > SET(QT_USE_QTOPENGL TRUE) > > INCLUDE( ${QT_USE_FILE} ) > > ADD_EXECUTABLE(exe main.cpp glwidget.cpp window.cpp) > > TARGET_LINK_LIBRARIES(exe ${QT_LIBRARIES}) > > > > Clint > > > > On Friday 26 September 2008 1:02:43 pm Linge Bai wrote: > > > Hi everybody, > > > > > > I have a project developed by Qt4's OpenGL, for example plenty of usage > > > > of > > > > > QGLWidget class. I want to use cmake to compile this project, instead > > > of using qmake, because I need to combine another project to it. I can > > > only link against Qt4 and OpenGL seperately. But I cannot link against > > > Qt4's OpenGL by simply setting SET(QT_USE_QTOPENGL TRUE), > > > ${QT_QTOPENGL_INCLUDE_DIR} or ${QT_QTOPENGL_LIBRARY}. I have no idea > > > > about > > > > > what else I need to add to my CMakeList.txt file: > > > > > > PROJECT ( COMBINED ) > > > > > > FIND_PACKAGE (Qt4 REQUIRED) > > > FIND_PACKAGE (OPENGL REQUIRED) > > > SET(QT_USE_QTMAIN TRUE) > > > SET(QT_USE_QTCORE TRUE) > > > SET(QT_USE_QTGUI TRUE) > > > SET(QT_USE_QTOPENGL TRUE) > > > INCLUDE( ${QT_USE_FILE} ) > > > > > > INCLUDE_DIRECTORIES( > > > ${QT_INCLUDES} > > > ${QT_INCLUDE_DIR} > > > ${QT_QT_INCLUDE_DIR} > > > ${QT_QTCORE_INCLUDE_DIR} > > > ${QT_QTGUI_INCLUDE_DIR} > > > ${QT_QTOPENGL_INCLUDE_DIR} > > > ) > > > > > > LINK_DIRECTORIES( > > > ${QT_LIBRARIES} > > > ${QT_LIBRARY_DIR} > > > ${QT_QTOPENGL_LIBRARY} > > > ${QT_QTGUI_LIBRARY} > > > ${QT_QTCORE_LIBRARY} > > > ${QT_MAIN_LIBRARY} > > > ) > > > > > > ADD_EXECUTABLE(exe main.cpp glwidget.cpp window.cpp) > > > TARGET_LINK_LIBRARIES(exe ${QT_LIBRARIES}) > > > > > > Could anyone please post a simple example to do this? Or could anyone > > > please give me some suggestions? Any help would be greatly appreciated. > > > > > > thanks, > > > Linge _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake