1# FindGLM - attempts to locate the glm matrix/vector library.
2#
3# This module defines the following variables (on success):
4#   GLM_INCLUDE_DIRS  - where to find glm/glm.hpp
5#   GLM_FOUND         - if the library was successfully located
6#
7# It is trying a few standard installation locations, but can be customized
8# with the following variables:
9#   GLM_ROOT_DIR      - root directory of a glm installation
10#                       Headers are expected to be found in either:
11#                       <GLM_ROOT_DIR>/glm/glm.hpp           OR
12#                       <GLM_ROOT_DIR>/include/glm/glm.hpp
13#                       This variable can either be a cmake or environment
14#                       variable. Note however that changing the value
15#                       of the environment varible will NOT result in
16#                       re-running the header search and therefore NOT
17#                       adjust the variables set by this module.
18
19#=============================================================================
20# Copyright 2012 Carsten Neumann
21#
22# Distributed under the OSI-approved BSD License (the "License");
23# see accompanying file Copyright.txt for details.
24#
25# This software is distributed WITHOUT ANY WARRANTY; without even the
26# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27# See the License for more information.
28#=============================================================================
29# (To distribute this file outside of CMake, substitute the full
30#  License text for the above reference.)
31
32# default search dirs
33SET(_glm_HEADER_SEARCH_DIRS
34    "/usr/include"
35    "/usr/local/include")
36
37# check environment variable
38SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
39
40IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
41    SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
42ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
43
44# put user specified location at beginning of search
45IF(GLM_ROOT_DIR)
46    SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
47                                "${GLM_ROOT_DIR}/include"
48                                 ${_glm_HEADER_SEARCH_DIRS})
49ENDIF(GLM_ROOT_DIR)
50
51# locate header
52FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
53    PATHS ${_glm_HEADER_SEARCH_DIRS})
54
55INCLUDE(FindPackageHandleStandardArgs)
56FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
57    GLM_INCLUDE_DIR)
58
59IF(GLM_FOUND)
60    SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
61ENDIF(GLM_FOUND)
62