FindGLEW¶
Finds the OpenGL Extension Wrangler Library (GLEW):
find_package(GLEW [<version>] [...])
GLEW is a cross-platform C/C++ library that helps manage OpenGL extensions by providing efficient run-time mechanisms to query and load OpenGL functionality beyond the core specification.
Added in version 3.7: Debug and Release library variants are found separately.
Added in version 3.15: If GLEW is built using its CMake-based build system, it provides a CMake
package configuration file (GLEWConfig.cmake). This module now takes that
into account and first attempts to find GLEW in config mode. If the
configuration file is not available, it falls back to module mode and
searches standard locations.
Imported Targets¶
This module provides the following Imported Targets:
GLEW::GLEWAdded in version 3.1.
The main imported target encapsulating the GLEW usage requirements, available if GLEW is found. It maps usage requirements of either
GLEW::gleworGLEW::glew_starget depending on their availability.GLEW::glewAdded in version 3.15.
Target encapsulating the usage requirements for a shared GLEW library. This target is available if GLEW is found and static libraries aren't requested via the
GLEW_USE_STATIC_LIBShint variable (see below).GLEW::glew_sAdded in version 3.15.
Target encapsulating the usage requirements for a static GLEW library. This target is available if GLEW is found and the
GLEW_USE_STATIC_LIBShint variable is set to boolean true.
Result Variables¶
This module defines the following variables:
GLEW_FOUNDBoolean indicating whether (the requested version of) GLEW was found.
GLEW_VERSIONAdded in version 3.15.
The version of GLEW found.
GLEW_VERSION_MAJORAdded in version 3.15.
The major version of GLEW found.
GLEW_VERSION_MINORAdded in version 3.15.
The minor version of GLEW found.
GLEW_VERSION_MICROAdded in version 3.15.
The micro version of GLEW found.
GLEW_INCLUDE_DIRSInclude directories needed to use GLEW library.
GLEW_LIBRARIESLibraries needed to link against to use GLEW library (shared or static depending on configuration).
GLEW_SHARED_LIBRARIESAdded in version 3.15.
Libraries needed to link against to use shared GLEW library.
GLEW_STATIC_LIBRARIESAdded in version 3.15.
Libraries needed to link against to use static GLEW library.
Hints¶
This module accepts the following variables before calling
find_package(GLEW) to influence this module's behavior:
GLEW_USE_STATIC_LIBSAdded in version 3.15.
Set to boolean true to find static GLEW library and create the
GLEW::glew_simported target for static linkage.GLEW_VERBOSEAdded in version 3.15.
Set to boolean true to output a detailed log of this module. Can be used, for example, for debugging.
Examples¶
Finding GLEW and linking it to a project target:
find_package(GLEW)
target_link_libraries(project_target PRIVATE GLEW::GLEW)
Using the static GLEW library, if found:
set(GLEW_USE_STATIC_LIBS TRUE)
find_package(GLEW)
target_link_libraries(project_target PRIVATE GLEW::GLEW)