forked from Eyescale/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindGLEW_MX.cmake
74 lines (65 loc) · 2.19 KB
/
FindGLEW_MX.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) 2010 Daniel Pfeifer <[email protected]>
# 2011-2013 Stefan Eilemann <[email protected]>
if(GLEW_MX_FIND_QUIETLY)
set(_glew_mx_output)
else()
set(_glew_mx_output 1)
endif()
find_path(_glew_mx_INCLUDE_DIR GL/glew.h
HINTS ${GLEW_ROOT}/include $ENV{GLEW_ROOT}/include /usr/include /usr/local/include /opt/local/include)
find_library(_glew_mx_LIBRARY
NAMES GLEWmx glew32mx GLEW glew glew32
HINTS ${GLEW_ROOT}/lib64 $ENV{GLEW_ROOT}/lib64 /usr/lib /usr/local/lib)
if(_glew_mx_INCLUDE_DIR AND _glew_mx_LIBRARY)
set(TEST_SRC ${PROJECT_BINARY_DIR}/glew_test.cpp)
file(WRITE ${TEST_SRC}
"#include <GL/glew.h>\n"
"int main( )\n"
"{\n"
" glewContextInit(0);\n"
"}\n"
)
try_compile(_glew_mx_SUPPORTED ${PROJECT_BINARY_DIR}/glew_test ${TEST_SRC}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${_glew_mx_INCLUDE_DIR}"
"-DLINK_LIBRARIES:STRING=${_glew_mx_LIBRARY}"
COMPILE_DEFINITIONS -DGLEW_MX=1
)
if(NOT _glew_mx_SUPPORTED)
if(_glew_mx_output)
message(STATUS " ${_glew_mx_LIBRARY} does not support GLEW_MX.")
endif()
set(_glew_mx_INCLUDE_DIR 0)
set(_glew_mx_LIBRARY 0)
elseif(X11_FOUND)
file(WRITE ${TEST_SRC}
"#include <GL/glxew.h>\n"
"int main( )\n"
"{\n"
" glxewContextInit(0);\n"
"}\n"
)
try_compile(_glxew_mx_SUPPORTED ${PROJECT_BINARY_DIR}/glew_test ${TEST_SRC}
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${_glew_mx_INCLUDE_DIR}"
"-DLINK_LIBRARIES:STRING=${_glew_mx_LIBRARY}"
COMPILE_DEFINITIONS -DGLEW_MX=1
)
if(NOT _glxew_mx_SUPPORTED)
if(_glew_mx_output)
message(STATUS " ${_glew_mx_LIBRARY} is missing glxewContextInit().")
endif()
set(_glew_mx_INCLUDE_DIR 0)
set(_glew_mx_LIBRARY 0)
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW_MX DEFAULT_MSG
_glew_mx_LIBRARY _glew_mx_INCLUDE_DIR)
set(GLEW_MX_INCLUDE_DIRS ${_glew_mx_INCLUDE_DIR})
set(GLEW_MX_LIBRARIES ${_glew_mx_LIBRARY})
if(GLEW_MX_FOUND AND _glew_mx_output)
message(STATUS
"Found GLEW_MX in ${GLEW_MX_INCLUDE_DIRS};${GLEW_MX_LIBRARIES}")
endif()