2015-12-10 16:35:43 +00:00
|
|
|
find_path( GLM_INCLUDE_DIR glm/glm.hpp
|
|
|
|
PATHS ${GLM_ROOT_DIR} $ENV{GLM_ROOT_DIR}
|
|
|
|
DOC "GLM library header path."
|
|
|
|
)
|
2015-12-08 10:52:09 +00:00
|
|
|
|
2015-12-10 16:35:43 +00:00
|
|
|
if( NOT ${GLM_INCLUDE_DIR} STREQUAL "GLM_INCLUDE_DIR-NOTFOUND" )
|
2015-12-08 10:52:09 +00:00
|
|
|
|
|
|
|
# attempt to extract the GLM Version information from setup.hpp
|
2015-12-10 16:35:43 +00:00
|
|
|
find_file( GLM_SETUP setup.hpp
|
|
|
|
PATHS ${GLM_INCLUDE_DIR}
|
|
|
|
PATH_SUFFIXES glm/core glm/detail
|
|
|
|
NO_DEFAULT_PATH )
|
|
|
|
|
|
|
|
if( NOT ${GLM_SETUP} STREQUAL "GLM_SETUP-NOTFOUND" )
|
2015-12-08 10:52:09 +00:00
|
|
|
|
|
|
|
# extract the "#define GLM_VERSION*" lines
|
|
|
|
file( STRINGS ${GLM_SETUP} _version REGEX "^#define.*GLM_VERSION.*" )
|
2015-12-10 16:35:43 +00:00
|
|
|
|
2015-12-08 10:52:09 +00:00
|
|
|
foreach( SVAR ${_version} )
|
|
|
|
string( REGEX MATCH GLM_VERSION_[M,A,J,O,R,I,N,P,T,C,H,E,V,I,S]* _VARNAME ${SVAR} )
|
|
|
|
string( REGEX MATCH [0-9]+ _VALUE ${SVAR} )
|
2015-12-10 16:35:43 +00:00
|
|
|
|
2015-12-08 10:52:09 +00:00
|
|
|
if( NOT ${_VARNAME} STREQUAL "" AND NOT ${_VALUE} STREQUAL "" )
|
|
|
|
set( _${_VARNAME} ${_VALUE} )
|
|
|
|
endif()
|
2015-12-10 16:35:43 +00:00
|
|
|
|
2015-12-08 10:52:09 +00:00
|
|
|
endforeach()
|
2015-12-10 16:35:43 +00:00
|
|
|
|
2015-12-08 10:52:09 +00:00
|
|
|
#ensure that NOT GLM_VERSION* will evaluate to '0'
|
|
|
|
if( NOT _GLM_VERSION_MAJOR )
|
|
|
|
set( _GLM_VERSION_MAJOR 0 )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if( NOT _GLM_VERSION_MINOR )
|
|
|
|
set( _GLM_VERSION_MINOR 0 )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if( NOT _GLM_VERSION_PATCH )
|
|
|
|
set( _GLM_VERSION_PATCH 0 )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if( NOT _GLM_VERSION_REVISION )
|
|
|
|
set( _GLM_VERSION_REVISION 0 )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set( GLM_VERSION ${_GLM_VERSION_MAJOR}.${_GLM_VERSION_MINOR}.${_GLM_VERSION_PATCH}.${_GLM_VERSION_REVISION} )
|
|
|
|
unset( GLM_SETUP CACHE )
|
2015-12-10 16:35:43 +00:00
|
|
|
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-12-08 10:52:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
include( FindPackageHandleStandardArgs )
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLM
|
2015-12-10 16:35:43 +00:00
|
|
|
REQUIRED_VARS
|
|
|
|
GLM_INCLUDE_DIR
|
|
|
|
GLM_VERSION
|
2015-12-08 10:52:09 +00:00
|
|
|
VERSION_VAR GLM_VERSION )
|
|
|
|
|
2015-12-10 16:35:43 +00:00
|
|
|
|
2015-12-08 10:52:09 +00:00
|
|
|
mark_as_advanced( GLM_INCLUDE_DIR )
|
|
|
|
set( GLM_VERSION_MAJOR ${_GLM_VERSION_MAJOR} CACHE INTERNAL "" )
|
|
|
|
set( GLM_VERSION_MINOR ${_GLM_VERSION_MINOR} CACHE INTERNAL "" )
|
|
|
|
set( GLM_VERSION_PATCH ${_GLM_VERSION_PATCH} CACHE INTERNAL "" )
|
|
|
|
set( GLM_VERSION_TWEAK ${_GLM_VERSION_REVISION} CACHE INTERNAL "" )
|