1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
# SPDX-FileCopyrightText: 2012-2021 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause
#[=======================================================================[.rst:
FindGLM
-------
Find the OpenGL Mathematics (glm)
Input variables
^^^^^^^^^^^^^^^
The following variables may be set to influence this module’s behavior:
``GLM_VERBOSE``
to output a detailed log of this module.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the :prop_tgt:`IMPORTED` target ``glm`` for the
library glm.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``GLM_FOUND``
true if assimp has been found and can be used
``GLM_INCLUDE_DIRS``
include directories for assimp
``GLM_VERSION``
GLM version
``GLM_VERSION_MAJOR``
GLM major version
``GLM_VERSION_MINOR``
GLM minor version
``GLM_VERSION_PATCH``
GLM patch version
#]=======================================================================]
include(FindPackageHandleStandardArgs)
find_package(GLM CONFIG QUIET)
if(GLM_FOUND)
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_CONFIG)
return()
endif()
if(GLM_VERBOSE)
message(STATUS "Findglm: did not find glm CMake config file. Searching for header files.")
endif()
find_path(GLM_INCLUDE_DIR glm/glm.hpp)
mark_as_advanced(GLM_INCLUDE_DIR)
set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
if(GLM_VERBOSE)
message(STATUS "Findglm: GLM_INCLUDE_DIR: ${GLM_INCLUDE_DIR}")
message(STATUS "Findglm: GLM_INCLUDE_DIRS: ${GLM_INCLUDE_DIRS}")
endif()
if(EXISTS "${GLM_INCLUDE_DIR}/glm/detail/setup.hpp")
file(STRINGS "${GLM_INCLUDE_DIR}/glm/detail/setup.hpp" _contents REGEX "#define GLM_VERSION_.+[ \t]+[0-9]+")
if(_contents)
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" GLM_VERSION_MAJOR "${_contents}")
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" GLM_VERSION_MINOR "${_contents}")
string(REGEX REPLACE ".*VERSION_PATCH[ \t]+([0-9]+).*" "\\1" GLM_VERSION_PATCH "${_contents}")
set(GLM_VERSION "${GLM_VERSION_MAJOR}.${GLM_VERSION_MINOR}.${GLM_VERSION_PATCH}")
endif()
endif()
if(GLM_VERBOSE)
message(STATUS "Findglm: GLM_VERSION_MAJOR: ${GLM_VERSION_MAJOR}")
message(STATUS "Findglm: GLM_VERSION_MINOR: ${GLM_VERSION_MINOR}")
message(STATUS "Findglm: GLM_VERSION_PATCH: ${GLM_VERSION_PATCH}")
message(STATUS "Findglm: GLM_VERSION: ${GLM_VERSION}")
endif()
find_package_handle_standard_args(GLM
REQUIRED_VARS GLM_INCLUDE_DIRS
VERSION_VAR GLM_VERSION)
if(NOT GLM_FOUND)
if(GLM_VERBOSE)
message(STATUS "Findglm: could not found glm headers.")
endif()
return()
endif()
if(NOT TARGET glm)
if(GLM_VERBOSE)
message(STATUS "Findglm: Creating glm imported target.")
endif()
add_library(glm INTERFACE IMPORTED)
set_target_properties(glm
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLM_INCLUDE_DIRS}")
endif()
# Set package properties if FeatureSummary was included
if(COMMAND set_package_properties)
set_package_properties(assimp PROPERTIES DESCRIPTION "OpenGL Mathematics (GLM)"
URL "https://glm.g-truc.net/")
endif()
|