FindGLEW.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #.rst:
  2. # FindGLEW
  3. # --------
  4. #
  5. # Find the OpenGL Extension Wrangler Library (GLEW)
  6. #
  7. # IMPORTED Targets
  8. # ^^^^^^^^^^^^^^^^
  9. #
  10. # This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
  11. # if GLEW has been found.
  12. #
  13. # Result Variables
  14. # ^^^^^^^^^^^^^^^^
  15. #
  16. # This module defines the following variables:
  17. #
  18. # ::
  19. #
  20. # GLEW_INCLUDE_DIRS - include directories for GLEW
  21. # GLEW_LIBRARIES - libraries to link against GLEW
  22. # GLEW_FOUND - true if GLEW has been found and can be used
  23. #=============================================================================
  24. # Copyright 2012 Benjamin Eikel
  25. #
  26. # Distributed under the OSI-approved BSD License (the "License");
  27. # see accompanying file Copyright.txt for details.
  28. #
  29. # This software is distributed WITHOUT ANY WARRANTY; without even the
  30. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  31. # See the License for more information.
  32. #=============================================================================
  33. # (To distribute this file outside of CMake, substitute the full
  34. # License text for the above reference.)
  35. find_path(GLEW_INCLUDE_DIR GL/glew.h)
  36. find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
  37. set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
  38. set(GLEW_LIBRARIES ${GLEW_LIBRARY})
  39. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  40. find_package_handle_standard_args(GLEW
  41. REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
  42. if(GLEW_FOUND AND NOT TARGET GLEW::GLEW)
  43. add_library(GLEW::GLEW UNKNOWN IMPORTED)
  44. set_target_properties(GLEW::GLEW PROPERTIES
  45. IMPORTED_LOCATION "${GLEW_LIBRARY}"
  46. INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
  47. endif()
  48. mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)