cmake_modules/FindGLEW.cmake
author unc0rr
Sat, 15 Jun 2013 23:45:53 +0400
branchwebgl
changeset 9166 3774ac58e65e
parent 8448 14f736ca7eb3
child 9201 bcf2f7798ebb
permissions -rw-r--r--
- Fix 'and not' without parentheses - Better detection of such occasions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     1
#
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     2
# Try to find GLEW library and include path.
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     3
# Once done this will define
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     4
#
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     5
# GLEW_FOUND
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
     6
# GLEW_INCLUDE_DIRS
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     7
# GLEW_LIBRARY
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     8
# 
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
     9
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    10
if (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    11
  # in cache already
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    12
  set(GLEW_FOUND TRUE)
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    13
else (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    14
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    15
    IF (WIN32)
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    16
        FIND_PATH( GLEW_INCLUDE_DIRS GL/glew.h
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    17
            $ENV{PROGRAMFILES}/GLEW/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    18
            ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    19
            DOC "The directory where GL/glew.h resides")
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    20
        FIND_LIBRARY( GLEW_LIBRARY
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    21
            NAMES glew GLEW glew32 glew32s
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    22
            PATHS
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    23
            $ENV{PROGRAMFILES}/GLEW/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    24
            ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    25
            ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    26
        DOC "The GLEW library")
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    27
    ELSE (WIN32)
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    28
        FIND_PATH( GLEW_INCLUDE_DIRS GL/glew.h
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    29
            /usr/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    30
            /usr/local/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    31
            /sw/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    32
            /opt/local/include
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    33
            DOC "The directory where GL/glew.h resides")
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    34
        FIND_LIBRARY( GLEW_LIBRARY
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    35
            NAMES GLEW glew
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    36
            PATHS
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    37
            /usr/lib64
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    38
            /usr/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    39
            /usr/local/lib64
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    40
            /usr/local/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    41
            /sw/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    42
            /opt/local/lib
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    43
            DOC "The GLEW library")
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    44
    ENDIF (WIN32)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    45
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    46
    IF (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    47
        SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    48
    ELSE (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    49
        SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    50
    ENDIF (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    51
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    52
endif(GLEW_LIBRARY AND GLEW_INCLUDE_DIRS)
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    53
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    54
if (GLEW_FOUND)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    55
    if (NOT GLEW_FIND_QUIETLY)
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    56
        message(STATUS "Found GLEW: ${GLEW_LIBRARY}, ${GLEW_INCLUDE_DIRS}")
7997
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    57
    endif (NOT GLEW_FIND_QUIETLY)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    58
else (GLEW_FOUND)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    59
    if (GLEW_FIND_REQUIRED)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    60
        message(FATAL_ERROR "Could NOT find GLEW")
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    61
    endif (GLEW_FIND_REQUIRED)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    62
endif (GLEW_FOUND)
7dff08baf9e3 add FindGLEW.cmake module
koda
parents:
diff changeset
    63
8448
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    64
#MARK_AS_ADVANCED( GLEW_FOUND )
14f736ca7eb3 update FindGLEW to use the same variables as in later CMake files and make sure to include its headers before compiling c stuff
koda
parents: 7997
diff changeset
    65