|
1 # Find GLEW |
1 # |
2 # |
2 # Try to find GLEW library and include path. |
|
3 # Once done this will define |
3 # Once done this will define |
|
4 # GLEW_FOUND - system has Sparkle |
|
5 # GLEW_INCLUDE_DIR - the Sparkle include directory |
|
6 # GLEW_LIBRARY - The library needed to use Sparkle |
|
7 # Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com> |
4 # |
8 # |
5 # GLEW_FOUND |
9 # Distributed under the OSI-approved BSD License (the "License"); |
6 # GLEW_INCLUDE_DIRS |
10 # see accompanying file Copyright.txt for details. |
7 # GLEW_LIBRARY |
11 # |
8 # |
12 # This software is distributed WITHOUT ANY WARRANTY; without even the |
|
13 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
14 # See the License for more information. |
9 |
15 |
10 if (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
16 include(FindPackageHandleStandardArgs) |
11 # in cache already |
|
12 set(GLEW_FOUND TRUE) |
|
13 else (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
|
14 |
17 |
15 IF (WIN32) |
18 find_path( GLEW_INCLUDE_DIR GL/glew.h |
16 FIND_PATH( GLEW_INCLUDE_DIRS 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_DIRS GL/glew.h |
|
29 /usr/include |
19 /usr/include |
30 /usr/local/include |
20 /usr/local/include |
31 /sw/include |
21 /sw/include |
32 /opt/local/include |
22 /opt/local/include |
|
23 $ENV{PROGRAMFILES}/GLEW/include |
33 DOC "The directory where GL/glew.h resides") |
24 DOC "The directory where GL/glew.h resides") |
34 FIND_LIBRARY( GLEW_LIBRARY |
25 find_library( GLEW_LIBRARY |
35 NAMES GLEW glew |
26 NAMES GLEW glew glew32 glew32s |
36 PATHS |
27 PATHS |
37 /usr/lib64 |
28 /usr/lib64 |
38 /usr/lib |
29 /usr/lib |
39 /usr/local/lib64 |
30 /usr/local/lib64 |
40 /usr/local/lib |
31 /usr/local/lib |
41 /sw/lib |
32 /sw/lib |
42 /opt/local/lib |
33 /opt/local/lib |
|
34 $ENV{PROGRAMFILES}/GLEW/lib |
43 DOC "The GLEW library") |
35 DOC "The GLEW library") |
44 ENDIF (WIN32) |
|
45 |
36 |
46 IF (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
37 find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIR GLEW_LIBRARY) |
47 SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") |
38 mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) |
48 ELSE (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
|
49 SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") |
|
50 ENDIF (GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
|
51 |
39 |
52 endif(GLEW_LIBRARY AND GLEW_INCLUDE_DIRS) |
|
53 |
|
54 if (GLEW_FOUND) |
|
55 if (NOT GLEW_FIND_QUIETLY) |
|
56 message(STATUS "Found GLEW: ${GLEW_LIBRARY}, ${GLEW_INCLUDE_DIRS}") |
|
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 ) |
|
65 |
|