11# - Try to find GLFW3
22#
3+ # If no pkgconfig, define GLFW_ROOT to installation tree
34# Will define the following:
45# GLFW3_FOUND
56# GLFW3_INCLUDE_DIRS
67# GLFW3_LIBRARIES
78
8- include (FindPackageHandleStandardArgs)
9+ IF (PKG_CONFIG_FOUND)
10+ IF (APPLE )
11+ # homebrew or macports pkgconfig locations
12+ SET (ENV{PKG_CONFIG_PATH} "/usr/local/opt/glfw3/lib/pkgconfig:/opt/local/lib/pkgconfig" )
13+ ENDIF ()
14+ SET (ENV{PKG_CONFIG_PATH} "${CMAKE_SOURCE_DIR} /../../depends/glfw/lib/pkgconfig:$ENV{PKG_CONFIG_PATH} " )
15+ PKG_CHECK_MODULES(GLFW3 glfw3)
916
10- IF (${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
11- find_path (GLFW3_INCLUDE_DIRS
12- glfw/glfw3.h
13- DOC "GLFW include directory "
14- PATHS $ENV{ProgramW6432} /glfw/include $ENV{GLFW_ROOT} /include )
15-
16- find_library (GLFW3_LIBRARIES
17- NAMES glfw3.lib glfw3dll.lib
18- PATHS $ENV{ProgramW6432} /glfw/lib/ $ENV{GLFW_ROOT} /lib/)
17+ RETURN ()
1918ENDIF ()
2019
21- find_package_handle_standard_args(GLFW3 "Could not find GLFW3 - try adding GLFW_ROOT in enviroment variables." GLFW3_INCLUDE_DIRS GLFW3_LIBRARIES)
20+ FIND_PATH (GLFW3_INCLUDE_DIRS
21+ GLFW/glfw3.h
22+ DOC "GLFW include directory "
23+ PATHS
24+ "${CMAKE_SOURCE_DIR} /../../depends/glfw"
25+ "$ENV{ProgramW6432} /glfw"
26+ ENV GLFW_ROOT
27+ PATH_SUFFIXES
28+ include
29+ )
30+
31+ # directories in the official binary package
32+ IF (MINGW)
33+ SET (_SUFFIX lib-mingw)
34+ ELSEIF (MSVC11)
35+ SET (_SUFFIX lib-vc2012)
36+ ELSEIF (MSVC )
37+ SET (_SUFFIX lib-vc2013)
38+ ENDIF ()
39+
40+ FIND_LIBRARY (GLFW3_LIBRARIES
41+ NAMES glfw3dll glfw3
42+ PATHS
43+ "${CMAKE_SOURCE_DIR} /../../depends/glfw"
44+ "$ENV{ProgramW6432} /glfw"
45+ ENV GLFW_ROOT
46+ PATH_SUFFIXES
47+ lib
48+ ${_SUFFIX}
49+ )
50+
51+ INCLUDE (FindPackageHandleStandardArgs)
52+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 "Could NOT find GLFW3 - try adding GLFW_ROOT in enviroment variables." GLFW3_LIBRARIES GLFW3_INCLUDE_DIRS)
0 commit comments