[CMake] CMake with Qt: Couldn't link against gluPerspective / gluLookAt under Linux, but does work on Win7 / VS2008

Christian Lohr aequinoktikum at googlemail.com
Wed Sep 1 05:21:18 EDT 2010


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})


More information about the CMake mailing list