FindGLFW3.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Locate the glfw3 library
  2. #
  3. # This module defines the following variables:
  4. #
  5. # GLFW3_LIBRARY the name of the library;
  6. # GLFW3_INCLUDE_DIR where to find glfw include files.
  7. # GLFW3_FOUND true if both the GLFW3_LIBRARY and GLFW3_INCLUDE_DIR have been found.
  8. #
  9. # To help locate the library and include file, you can define a
  10. # variable called GLFW3_ROOT which points to the root of the glfw library
  11. # installation.
  12. #
  13. # default search dirs
  14. #
  15. # Cmake file from: https://github.com/daw42/glslcookbook
  16. set( _glfw3_HEADER_SEARCH_DIRS
  17. "/usr/include"
  18. "/usr/local/include"
  19. "${CMAKE_SOURCE_DIR}/includes" )
  20. set( _glfw3_LIB_SEARCH_DIRS
  21. "/usr/lib"
  22. "/usr/local/lib"
  23. "${CMAKE_SOURCE_DIR}/lib")
  24. # Check environment for root search directory
  25. set( _glfw3_ENV_ROOT $ENV{GLFW3_ROOT} )
  26. if( NOT GLFW3_ROOT AND _glfw3_ENV_ROOT )
  27. set(GLFW3_ROOT ${_glfw3_ENV_ROOT} )
  28. endif()
  29. # Put user specified location at beginning of search
  30. if( GLFW3_ROOT )
  31. list( INSERT _glfw3_HEADER_SEARCH_DIRS 0 "${GLFW3_ROOT}/include" )
  32. list( INSERT _glfw3_LIB_SEARCH_DIRS 0 "${GLFW3_ROOT}/lib" )
  33. endif()
  34. # Search for the header
  35. FIND_PATH(GLFW3_INCLUDE_DIR "GLFW/glfw3.h"
  36. PATHS ${_glfw3_HEADER_SEARCH_DIRS} )
  37. # Search for the library
  38. FIND_LIBRARY(GLFW3_LIBRARY NAMES glfw3 glfw
  39. PATHS ${_glfw3_LIB_SEARCH_DIRS} )
  40. INCLUDE(FindPackageHandleStandardArgs)
  41. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 DEFAULT_MSG
  42. GLFW3_LIBRARY GLFW3_INCLUDE_DIR)