On Thu, Feb 19, 2009 at 8:18 PM, Andrea Tagliasacchi <a...@cs.sfu.ca> wrote:
> Hello everybody, > > I have given up on Makefiles, implicit rules and unreadability just annoyed > me. > Also the ability of generating cross platform compile files is very > appealing. > > As far as I compile my independent code (no external libraries) > everything goes fine. However, one of my applications is a simple > OpenGL based visualizer and I am having problems finding the correct > set of setting of the CMakeLists.txt. > > Right now I hacked a *temporary solution* that compiles that file > in an architecture dependent way: > > find_package(GLUT) > find_package(OpenGL) > IF(APPLE) > SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL -framework GLUT") > ADD_EXECUTABLE(mesh_view mesh_view.cpp) > ENDIF(APPLE) > > Browsing around I was able to construct the following but I am still > getting > linking errors as reported below: > > find_package(GLUT) > find_package(OpenGL) > if (OPENGL_FOUND) > MESSAGE("OpenGL Correctly Found") > include_directories(${OPENGL_INCLUDE_DIR}) > else (OPENGL_FOUND) > MESSAGE("OpenGL environment missing") > endif (OPENGL_FOUND) > > Example of linking errors: > Linking CXX executable mesh_view > Undefined symbols: > "_glViewport", referenced from: > reshapeCallback(int, int)in mesh_view.cpp.o > "_glMaterialfv", referenced from: > displayCallback() in mesh_view.cpp.o > "_glLoadIdentity", referenced from: > init_opengl() in mesh_view.cpp.o > motionCallback(int, int)in mesh_view.cpp.o > displayCallback() in mesh_view.cpp.o > > I also checked the CMake files of OpenSceneGraph > but I can find only include directory specifications, no linking. > > Browsing around I also found the following but even if I add them nothing > changes: > INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake) > SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY}) > LINK_DIRECTORIES(${OPENGL_LIBRARIES}) > Any suggestion? Try TARGET_LINK_LIBRARIES(mesh_view ${OPENGL_LIBRARIES}) If it fails to link you can use "make VERBOSE=1" to look at the compiler/linker flags. -- Philip Lowman
_______________________________________________ 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