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.
在 3.7 版被加入: Debug and Release library variants are found separately.
在 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::GLEW
在 3.1 版被加入.
The main imported target encapsulating the GLEW usage requirements, available if GLEW is found. It maps usage requirements of either
GLEW::glew
orGLEW::glew_s
target depending on their availability.GLEW::glew
在 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_LIBS
hint variable (see below).GLEW::glew_s
在 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_LIBS
hint variable is set to boolean true.
結果變數¶
This module defines the following variables:
GLEW_FOUND
Boolean indicating whether GLEW is found.
GLEW_VERSION
在 3.15 版被加入.
The version of GLEW found.
GLEW_VERSION_MAJOR
在 3.15 版被加入.
The major version of GLEW found.
GLEW_VERSION_MINOR
在 3.15 版被加入.
The minor version of GLEW found.
GLEW_VERSION_MICRO
在 3.15 版被加入.
The micro version of GLEW found.
GLEW_INCLUDE_DIRS
Include directories needed to use GLEW library.
GLEW_LIBRARIES
Libraries needed to link against to use GLEW library (shared or static depending on configuration).
GLEW_SHARED_LIBRARIES
在 3.15 版被加入.
Libraries needed to link against to use shared GLEW library.
GLEW_STATIC_LIBRARIES
在 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_LIBS
在 3.15 版被加入.
Set to boolean true to find static GLEW library and create the
GLEW::glew_s
imported target for static linkage.GLEW_VERBOSE
在 3.15 版被加入.
Set to boolean true to output a detailed log of this module. Can be used, for example, for debugging.
範例¶
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)