David Morris wrote:
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 <http://cmake.org> site and the linuxjournal one?

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
...
...

and so on...

I read somewhere this might have to do with cmake trying to compile C++ code using gcc instead of g++, and that you can override this setting in the CMakeCache file, but this is the line in the CMakeCache.txt file:

CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

I tried changing it to g++, but it didn't seem to do anything. I don't think this has much to do with the actual code of the project, so I didn't bother explaining anything about it here. Any help would be greatly appreciated. I'm thinking it's a really simple error, but who knows. Here is the text of my main CMakeLists.txt file:

---

#Change PROJECT_NAME to the name of your project
PROJECT(TopMod)
#include some macros from another file...
INCLUDE(${TopMod_SOURCE_DIR}/CMakeMacros.txt)
#Declare any external dependencies that your project may have here.
#examples include: ITK, VTK, JPEG, PNG, OpenGL, ZLIB, Perl, Java
#If you're not sure what name to use, look in the Modules directory of your
#cmake install and check that a file named Find(Package).cmake exists
SET(Required_Packages
FLTK JPEG PNG OpenGL ZLIB GLUT
)
FOREACH(Package ${Required_Packages})
  LOADPACKAGE(${Package})
ENDFOREACH(Package)

#run through these sub directories to build these two libraries
SUBDIRS(vecmat)
SUBDIRS(arcball)

INCLUDE_DIRECTORIES(${TopMod_SOURCE_DIR}/arcball ${TopMod_SOURCE_DIR}/vecmat ${TopMod_SOURCE_DIR}/include /opt/local/lib) LINK_DIRECTORIES(${TopMod_BINARY_DIR}/arcball ${TopMod_BINARY_DIR}/vecmat ${TopMod_BINARY_DIR}/include /opt/local/lib)

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})
You need to link in the opengl library.

-Bill

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to