Dear CMake developers,
please find attached a small patch that introduces the hinting variable
GLEW_ROOT to FindGLEW.cmake.

Best
Christoph
From c6caa68391010f9fb399d86b1e6ec154d4be3605 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <[email protected]>
Date: Sun, 22 Nov 2015 14:37:09 +0100
Subject: [PATCH] FindGLEW: Add hinting variable GLEW_ROOT

---
 Modules/FindGLEW.cmake | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index f42182f..8521db8 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -20,9 +20,17 @@
 #   GLEW_INCLUDE_DIRS - include directories for GLEW
 #   GLEW_LIBRARIES - libraries to link against GLEW
 #   GLEW_FOUND - true if GLEW has been found and can be used
+#
+# Hinting Variable
+# ^^^^^^^^^^^^^^^^
+#
+# This module reads hints about search locations from::
+#
+#   GLEW_ROOT             - Installation prefix
 
 #=============================================================================
 # Copyright 2012 Benjamin Eikel
+# Copyright 2015 Christoph Grüninger
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -34,8 +42,25 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_path(GLEW_INCLUDE_DIR GL/glew.h)
-find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
+# find header glew.h, first in GLEW_ROOT then in default paths
+find_path(GLEW_INCLUDE_DIR
+  NAMES glew.h
+  PATHS ${GLEW_ROOT}
+  PATH_SUFFIXES include GL
+  NO_DEFAULT_PATH)
+find_path(GLEW_INCLUDE_DIR
+  PATH_SUFFIXES include GL
+  NAMES glew.h)
+
+# find library glew, first in GLEW_ROOT then in default paths
+find_library(GLEW_LIBRARY
+  NAMES GLEW glew32 glew glew32s
+  PATHS ${GLEW_ROOT}
+  PATH_SUFFIXES lib lib32 lib64
+  NO_DEFAULT_PATH)
+find_library(GLEW_LIBRARY
+  NAMES GLEW glew32 glew glew32s
+  PATH_SUFFIXES lib lib32 lib64)
 
 set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
 set(GLEW_LIBRARIES ${GLEW_LIBRARY})
-- 
2.6.2

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to