cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

FindGLEW.cmake (2943B)


      1 # Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>                                                                                          
      2 #                                                                                                                                                
      3 # Redistribution and use is allowed according to the terms of the BSD license.                                                                   
      4 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 
      5 # 
      6 # - try to find glew library and include files
      7 #  GLEW_INCLUDE_DIR, where to find GL/glew.h, etc.
      8 #  GLEW_LIBRARIES, the libraries to link against
      9 #  GLEW_FOUND, If false, do not try to use GLEW.
     10 # Also defined, but not for general use are:
     11 #  GLEW_GLEW_LIBRARY = the full path to the glew library.
     12 
     13 if (WIN32)
     14 
     15   if(CYGWIN)
     16 
     17     find_path( GLEW_INCLUDE_DIR GL/glew.h)
     18 
     19     find_library( GLEW_GLEW_LIBRARY glew32
     20       ${OPENGL_LIBRARY_DIR}
     21       /usr/lib/w32api
     22       /usr/X11R6/lib
     23     )
     24 
     25 
     26   else(CYGWIN)
     27   
     28     find_path( GLEW_INCLUDE_DIR GL/glew.h
     29       $ENV{GLEW_ROOT_PATH}/include
     30     )
     31 
     32     find_library( GLEW_GLEW_LIBRARY
     33       NAMES glew glew32
     34       PATHS
     35       $ENV{GLEW_ROOT_PATH}/lib
     36       ${OPENGL_LIBRARY_DIR}
     37     )
     38 
     39   endif(CYGWIN)
     40 
     41 else (WIN32)
     42 
     43   if (APPLE)
     44 # These values for Apple could probably do with improvement.
     45     find_path( GLEW_INCLUDE_DIR glew.h
     46       /System/Library/Frameworks/GLEW.framework/Versions/A/Headers
     47       ${OPENGL_LIBRARY_DIR}
     48     )
     49     set(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX")
     50     set(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
     51   else (APPLE)
     52 
     53     find_path( GLEW_INCLUDE_DIR GL/glew.h
     54       /usr/include/GL
     55       /usr/openwin/share/include
     56       /usr/openwin/include
     57       /usr/X11R6/include
     58       /usr/include/X11
     59       /opt/graphics/OpenGL/include
     60       /opt/graphics/OpenGL/contrib/libglew
     61     )
     62 
     63     find_library( GLEW_GLEW_LIBRARY GLEW
     64       /usr/openwin/lib
     65       /usr/X11R6/lib
     66     )
     67 
     68   endif (APPLE)
     69 
     70 endif (WIN32)
     71 
     72 set( GLEW_FOUND "NO" )
     73 if(GLEW_INCLUDE_DIR)
     74   if(GLEW_GLEW_LIBRARY)
     75     # Is -lXi and -lXmu required on all platforms that have it?
     76     # If not, we need some way to figure out what platform we are on.
     77     set( GLEW_LIBRARIES
     78       ${GLEW_GLEW_LIBRARY}
     79       ${GLEW_cocoa_LIBRARY}
     80     )
     81     set( GLEW_FOUND "YES" )
     82 
     83 #The following deprecated settings are for backwards compatibility with CMake1.4
     84     set (GLEW_LIBRARY ${GLEW_LIBRARIES})
     85     set (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR})
     86 
     87   endif(GLEW_GLEW_LIBRARY)
     88 endif(GLEW_INCLUDE_DIR)
     89 
     90 if(GLEW_FOUND)
     91   if(NOT GLEW_FIND_QUIETLY)
     92     message(STATUS "Found Glew: ${GLEW_LIBRARIES}")
     93   endif(NOT GLEW_FIND_QUIETLY)
     94 else(GLEW_FOUND)
     95   if(GLEW_FIND_REQUIRED)
     96     message(FATAL_ERROR "Could not find Glew")
     97   endif(GLEW_FIND_REQUIRED)
     98 endif(GLEW_FOUND)
     99 
    100 mark_as_advanced(
    101   GLEW_INCLUDE_DIR
    102   GLEW_GLEW_LIBRARY
    103   GLEW_Xmu_LIBRARY
    104   GLEW_Xi_LIBRARY
    105 )