added FindGLM.cmake

Wed, 22 Jan 2020 22:43:28 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 22 Jan 2020 22:43:28 +0200
changeset 29
4cc6b582fde8
parent 28
c92c1daf735f
child 30
1536f23cfab7

added FindGLM.cmake

CMake/FindGLM.cmake file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CMake/FindGLM.cmake	Wed Jan 22 22:43:28 2020 +0200
@@ -0,0 +1,52 @@
+#
+# Find GLM
+#
+# Try to find GLM : OpenGL Mathematics.
+# This module defines 
+# - GLM_INCLUDE_DIRS
+# - GLM_FOUND
+#
+# The following variables can be set as arguments for the module.
+# - GLM_ROOT_DIR : Root library directory of GLM 
+#
+# References:
+# - https://github.com/Groovounet/glm/blob/master/util/FindGLM.cmake
+# - https://bitbucket.org/alfonse/gltut/src/28636298c1c0/glm-0.9.0.7/FindGLM.cmake
+#
+
+# Additional modules
+include(FindPackageHandleStandardArgs)
+
+if (WIN32)
+	# Find include files
+	find_path(
+		GLM_INCLUDE_DIR
+		NAMES glm/glm.hpp
+		PATHS
+		$ENV{PROGRAMFILES}/include
+		${GLM_ROOT_DIR}/include
+		DOC "The directory where glm/glm.hpp resides")
+else()
+	# Find include files
+	find_path(
+		GLM_INCLUDE_DIR
+		NAMES glm/glm.hpp
+		PATHS
+		/usr/include
+		/usr/local/include
+		/sw/include
+		/opt/local/include
+		${GLM_ROOT_DIR}/include
+		DOC "The directory where glm/glm.hpp resides")
+endif()
+
+# Handle REQUIRD argument, define *_FOUND variable
+find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)
+
+# Define GLM_INCLUDE_DIRS
+if (GLM_FOUND)
+	set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
+endif()
+
+# Hide some variables
+mark_as_advanced(GLM_INCLUDE_DIR)

mercurial