fixed: compile issue
[opensg.git] / CMake / FindGLUT_OpenSG.cmake
blob582b8527a6c26214f790af954c5146c4eae5fe8c
1 # - try to find glut library and include files
2 #  GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
3 #  GLUT_LIBRARIES, the libraries to link against
4 #  GLUT_FOUND, If false, do not try to use GLUT.
5 # Also defined, but not for general use are:
6 #  GLUT_glut_LIBRARY = the full path to the glut library.
7 #  GLUT_Xmu_LIBRARY  = the full path to the Xmu library.
8 #  GLUT_Xi_LIBRARY   = the full path to the Xi Library.
11 IF (WIN32)
13   FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h 
14     PATHS  ${GLUT_ROOT_PATH}/include )
16   SET( GLUT_NAMES_RELEASE ${GLUT_NAMES_RELEASE} freeglut glut glut32 )
17   FIND_LIBRARY( GLUT_glut_LIBRARY_RELEASE NAMES ${GLUT_NAMES_RELEASE}
18     PATHS
19     ${OPENGL_LIBRARY_DIR}
20     ${GLUT_ROOT_PATH}/Release
21     )
23   SET( GLUT_NAMES_DEBUG ${GLUT_NAMES_DEBUG} freeglutd glutd glut32d )
24   FIND_LIBRARY( GLUT_glut_LIBRARY_DEBUG NAMES ${GLUT_NAMES_DEBUG}
25     PATHS
26     ${OPENGL_LIBRARY_DIR}
27     ${GLUT_ROOT_PATH}/Debug
28     )
29 ELSE (WIN32)
31   MESSAGE(ERROR "Only to be used on WIN32 platforms")
32   
33   IF (APPLE)
34     # These values for Apple could probably do with improvement.
35     FIND_PATH( GLUT_INCLUDE_DIR glut.h
36       /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
37       ${OPENGL_LIBRARY_DIR}
38       )
39     SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") 
40     SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
41   ELSE (APPLE)
42     
43     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
44       /usr/include/GL
45       /usr/openwin/share/include
46       /usr/openwin/include
47       /opt/graphics/OpenGL/include
48       /opt/graphics/OpenGL/contrib/libglut
49       )
50   
51     FIND_LIBRARY( GLUT_glut_LIBRARY glut
52       /usr/openwin/lib
53       )
54     
55     FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
56       /usr/openwin/lib
57       )
58     
59     FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
60       /usr/openwin/lib
61       )
62     
63   ENDIF (APPLE)
64   
65 ENDIF (WIN32)
67 SET( GLUT_FOUND "NO" )
68 IF(GLUT_INCLUDE_DIR)
69   IF(GLUT_glut_LIBRARY_DEBUG OR GLUT_glut_LIBRARY_RELEASE)
70     # Is -lXi and -lXmu required on all platforms that have it?
71     # If not, we need some way to figure out what platform we are on.
72 #    SET( GLUT_LIBRARIES
73 #      ${GLUT_glut_LIBRARY}
74 #      ${GLUT_Xmu_LIBRARY}
75 #      ${GLUT_Xi_LIBRARY} 
76 #      ${GLUT_cocoa_LIBRARY}
77 #      )
78     SET( GLUT_FOUND "YES" )
79     
80     #The following deprecated settings are for backwards compatibility with CMake1.4
81 #    SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
82     SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
83     
84   ENDIF(GLUT_glut_LIBRARY_DEBUG OR GLUT_glut_LIBRARY_RELEASE)
85 ENDIF(GLUT_INCLUDE_DIR)
87 MARK_AS_ADVANCED(
88   GLUT_INCLUDE_DIR
89   GLUT_glut_LIBRARY_RELEASE
90   GLUT_glut_LIBRARY_DEBUG
91 #  GLUT_Xmu_LIBRARY
92 #  GLUT_Xi_LIBRARY
93   )