[CMake] CMake with Qt: Couldn't link against gluPerspective / gluLookAt under Linux, but does work on Win7 / VS2008
Clinton Stimpson
clinton at elemtech.com
Wed Sep 1 10:57:20 EDT 2010
You are not linking with OpenGL libraries. Perhaps the difference you are
seeing is because of cleanup in FindQt4.cmake. It no longer links OpenGL
libraries for you. If you write code using OpenGL, you should make that
explicit in your CMakeLists.txt file.
So, try using FindOpenGL.cmake.
Clint
On Wednesday, September 01, 2010 03:21:18 am Christian Lohr wrote:
> Sorry for bothering you again, but I cannot figure out, why this
> compiles under Windows but doesn't compile under Debian Linux.
>
> Yours sincerely,
>
> Christian Lohr
>
> -------
>
> Under Debian the build output is following:
>
> Scanning dependencies of target applikation
> [ 12%] Building CXX object CMakeFiles/applikation.dir/mainwidget.cpp.o
> Linking CXX executable applikation
> CMakeFiles/applikation.dir/applikationwindow.cpp.o: In function
> `ApplikationWindow::resizeGL(int, int)':
> applikationwindow.cpp:(.text+0x3c4): undefined reference to
> `gluPerspective' applikationwindow.cpp:(.text+0x40c): undefined reference
> to `gluLookAt' collect2: ld returned 1 exit status
> make[2]: *** [applikation] Fehler 1
> make[1]: *** [CMakeFiles/applikation.dir/all] Fehler 2
> make: *** [all] Fehler 2
>
>
> ---------------------------------------------------------------------------
> ---------------------------------------------------------------------------
> -------------------------------- This is the CMakeLists.txt:
>
> project(GLApplikation2)
>
> cmake_minimum_required(VERSION 2.6.0)
>
> find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
> include(${QT_USE_FILE})
>
> set(SOURCE_FILES
> applikationwindow.cpp
> main.cpp
> mainwidget.cpp
> )
>
> set(HEADER_FILES
> applikationwindow.h
> mainwidget.h
> )
>
> set(UI_FILES
> mainwidget.ui
> )
>
> qt4_wrap_ui(SOURCE_FILES ${UI_FILES})
> qt4_wrap_cpp(SOURCE_FILES ${HEADER_FILES})
>
> include_directories(${CMAKE_CURRENT_BINARY_DIR})
>
> add_executable(applikation ${SOURCE_FILES})
> target_link_libraries(applikation ${QT_LIBRARIES})
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list