[Bf-blender-cvs] [02b6ba8] master: CMake: use our template for finding the glew library

Campbell Barton noreply at git.blender.org
Mon Jul 28 19:44:00 CEST 2014


Commit: 02b6ba88748023cd28fdf9e50d6448ebb8cc7324
Author: Campbell Barton
Date:   Tue Jul 29 03:37:56 2014 +1000
Branches: master
https://developer.blender.org/rB02b6ba88748023cd28fdf9e50d6448ebb8cc7324

CMake: use our template for finding the glew library

===================================================================

M	CMakeLists.txt
M	build_files/cmake/Modules/FindGLEW.cmake

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f32f79..8be3a9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2066,10 +2066,7 @@ if(WITH_SYSTEM_GLEW)
 		message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW")
 	endif()
 
-	mark_as_advanced(
-		GLEW_LIBRARY
-		GLEW_INCLUDE_PATH
-	)
+	set(GLEW_INCLUDE_PATH "${GLEW_INCLUDE_DIRS}")
 else()
 	# set(GLEW_LIBRARY "")  # unused
 	set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake
index 3f7cca3..551a7aa 100644
--- a/build_files/cmake/Modules/FindGLEW.cmake
+++ b/build_files/cmake/Modules/FindGLEW.cmake
@@ -1,59 +1,67 @@
+# - Find GLEW library
+# Find the native Glew includes and library
+# This module defines
+#  GLEW_INCLUDE_DIRS, where to find glew.h, Set when
+#                        GLEW_INCLUDE_DIR is found.
+#  GLEW_LIBRARIES, libraries to link against to use Glew.
+#  GLEW_ROOT_DIR, The base directory to search for Glew.
+#                    This can also be an environment variable.
+#  GLEW_FOUND, If false, do not try to use Glew.
 #
-# Try to find GLEW library and include path.
-# Once done this will define
+# also defined, but not for general use are
+#  GLEW_LIBRARY, where to find the Glew library.
+
+#=============================================================================
+# Copyright 2014 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
 #
-# GLEW_FOUND
-# GLEW_INCLUDE_PATH
-# GLEW_LIBRARY
-# 
-
-IF (WIN32)
-	FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
-		$ENV{PROGRAMFILES}/GLEW/include
-		${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
-		DOC "The directory where GL/glew.h resides")
-	IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-		FIND_LIBRARY( GLEW_LIBRARY
-			NAMES glew64 glew64s
-			PATHS
-			$ENV{PROGRAMFILES}/GLEW/lib
-			${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
-			${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
-			DOC "The GLEW library (64-bit)"
-		)
-	ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-		FIND_LIBRARY( GLEW_LIBRARY
-			NAMES glew GLEW glew32 glew32s
-			PATHS
-			$ENV{PROGRAMFILES}/GLEW/lib
-			${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
-			${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
-			DOC "The GLEW library"
-		)
-	ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
-ELSE (WIN32)
-	FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
-		/usr/include
-		/usr/local/include
-		/sw/include
-		/opt/local/include
-		DOC "The directory where GL/glew.h resides")
-	FIND_LIBRARY( GLEW_LIBRARY
-		NAMES GLEW glew
-		PATHS
-		/usr/lib64
-		/usr/lib
-		/usr/local/lib64
-		/usr/local/lib
-		/sw/lib
-		/opt/local/lib
-		DOC "The GLEW library")
-ENDIF (WIN32)
-
-IF (GLEW_INCLUDE_PATH)
-	SET(GLEW_FOUND TRUE)
-ELSE (GLEW_INCLUDE_PATH)
-	SET(GLEW_FOUND FALSE)
-ENDIF (GLEW_INCLUDE_PATH)
-
-MARK_AS_ADVANCED( GLEW_FOUND )
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If GLEW_ROOT_DIR was defined in the environment, use it.
+IF(NOT GLEW_ROOT_DIR AND NOT $ENV{GLEW_ROOT_DIR} STREQUAL "")
+	SET(GLEW_ROOT_DIR $ENV{GLEW_ROOT_DIR})
+ENDIF()
+
+SET(_glew_SEARCH_DIRS
+  ${GLEW_ROOT_DIR}
+  /usr/local
+)
+
+FIND_PATH(GLEW_INCLUDE_DIR
+  NAMES
+    GL/glew.h
+  HINTS
+    ${_glew_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include
+)
+
+FIND_LIBRARY(GLEW_LIBRARY
+  NAMES
+    GLEW
+  HINTS
+    ${_glew_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glew DEFAULT_MSG
+    GLEW_LIBRARY GLEW_INCLUDE_DIR)
+
+IF(GLEW_FOUND)
+  SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
+  SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
+ENDIF(GLEW_FOUND)
+
+MARK_AS_ADVANCED(
+  GLEW_INCLUDE_DIR
+  GLEW_LIBRARY
+)




More information about the Bf-blender-cvs mailing list