cmake_modules/FindGLEW.cmake
branchwebgl
changeset 7997 7dff08baf9e3
child 8448 14f736ca7eb3
equal deleted inserted replaced
7995:889ad929cc81 7997:7dff08baf9e3
       
     1 #
       
     2 # Try to find GLEW library and include path.
       
     3 # Once done this will define
       
     4 #
       
     5 # GLEW_FOUND
       
     6 # GLEW_INCLUDE_PATH
       
     7 # GLEW_LIBRARY
       
     8 # 
       
     9 
       
    10 if (GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    11   # in cache already
       
    12   set(GLEW_FOUND TRUE)
       
    13 else (GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    14 
       
    15     IF (WIN32)
       
    16         FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
       
    17             $ENV{PROGRAMFILES}/GLEW/include
       
    18             ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
       
    19             DOC "The directory where GL/glew.h resides")
       
    20         FIND_LIBRARY( GLEW_LIBRARY
       
    21             NAMES glew GLEW glew32 glew32s
       
    22             PATHS
       
    23             $ENV{PROGRAMFILES}/GLEW/lib
       
    24             ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
       
    25             ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
       
    26         DOC "The GLEW library")
       
    27     ELSE (WIN32)
       
    28         FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
       
    29             /usr/include
       
    30             /usr/local/include
       
    31             /sw/include
       
    32             /opt/local/include
       
    33             DOC "The directory where GL/glew.h resides")
       
    34         FIND_LIBRARY( GLEW_LIBRARY
       
    35             NAMES GLEW glew
       
    36             PATHS
       
    37             /usr/lib64
       
    38             /usr/lib
       
    39             /usr/local/lib64
       
    40             /usr/local/lib
       
    41             /sw/lib
       
    42             /opt/local/lib
       
    43             DOC "The GLEW library")
       
    44     ENDIF (WIN32)
       
    45 
       
    46     IF (GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    47         SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
       
    48     ELSE (GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    49         SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
       
    50     ENDIF (GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    51 
       
    52 endif(GLEW_LIBRARY AND GLEW_INCLUDE_PATH)
       
    53 
       
    54 if (GLEW_FOUND)
       
    55     if (NOT GLEW_FIND_QUIETLY)
       
    56         message(STATUS "Found GLEW: ${GLEW_LIBRARY}, ${GLEW_INCLUDE_PATH}")
       
    57     endif (NOT GLEW_FIND_QUIETLY)
       
    58 else (GLEW_FOUND)
       
    59     if (GLEW_FIND_REQUIRED)
       
    60         message(FATAL_ERROR "Could NOT find GLEW")
       
    61     endif (GLEW_FIND_REQUIRED)
       
    62 endif (GLEW_FOUND)
       
    63 
       
    64 #MARK_AS_ADVANCED( GLEW_FOUND )