[CMake] CMake Tutorial and Error: undefined symbols

Eric Noulard eric.noulard at gmail.com
Sun Jan 28 06:53:29 EST 2007


2007/1/27, David Morris <dvmorris at gmail.com>:
> I'm new to cmake, and I have been trying to find a good comprehensive
> tutorial to get myself started, but have had no luck. Does anyone know a
> good one besides the cmake.org site and the linuxjournal one?

No but the Wiki http://www.cmake.org/Wiki/CMake
is a good start.

Moreover I advise you to read (even fast read) the
documentation "man cmake" or "http://www.cmake.org/HTML/Documentation.html".

>From my experience with different collegue/friend
"standalone" startup time  with CMake is from 1 to 3 days
where you find yourself "lost".

After that period you keep getting things work as you want
faster and faster.

>
> I will try to describe one problem i'm having, but I'm not really sure where
> to begin. I'm trying to compile a C++ project and I get this error:
>
> /usr/bin/ld: Undefined symbols:
> _glBegin
>  _glBindTexture
> _glColor3d
> _glColor3f
> _glCullFace
> ...
> ...

Seems you need to link with OpenGL.
Try add the following to

FIND_PACKAGE(OpenGL)
IF (OPENGL_FOUND)
  MESSAGE(STATUS "Looking for OpenGL - found : ${OPENGL_gl_LIBRARY}")
  GET_FILENAME_COMPONENT(GLPATH ${OPENGL_gl_LIBRARY} PATH)
  LINK_DIRECTORIES(${GLPATH})
ELSE (OPENGL_FOUND)
  MESSAGE(STATUS "Looking for OpenGL - not found")
ENDIF (OPENGL_FOUND)


>
> SET(Libraries fltk_images fltk_gl fltk arcball vecmat)
>
> SET(CurrentExe "TopMod")
> FILE(GLOB SRC *.cc)
> ADD_EXECUTABLE(${CurrentExe} ${SRC})
> TARGET_LINK_LIBRARIES(${CurrentExe} ${Libraries})

ADD GL library

TARGET_LINK_LIBRARIES(${CurrentExe} ${OPENGL_gl_LIBRARY})

-- 
Erk


More information about the CMake mailing list