FindGLEW¶
Finds the OpenGL Extension Wrangler Library (GLEW).
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.
New in version 3.7: Debug and Release library variants are found separately.
New 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::GLEWNew 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::glewNew 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_sNew 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 GLEW is found.
GLEW_VERSIONNew in version 3.15.
The version of GLEW found.
GLEW_VERSION_MAJORNew in version 3.15.
The major version of GLEW found.
GLEW_VERSION_MINORNew in version 3.15.
The minor version of GLEW found.
GLEW_VERSION_MICRONew 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_LIBRARIESNew in version 3.15.
Libraries needed to link against to use shared GLEW library.
GLEW_STATIC_LIBRARIESNew 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_LIBSNew in version 3.15.
Set to boolean true to find static GLEW library and create the
GLEW::glew_simported target for static linkage.GLEW_VERBOSENew 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)