cmake: * make FindGlew more robust & consistent

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3946 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-10-19 13:33:57 +00:00
parent 2b068be3ab
commit b878c5db6b
2 changed files with 18 additions and 14 deletions

View File

@ -2,13 +2,17 @@
# Try to find GLEW library and include path. # Try to find GLEW library and include path.
# Once done this will define # Once done this will define
# #
# GLEW_FOUND # GLEW_FOUND - system has GLEW
# GLEW_INCLUDE_PATH # GLEW_INCLUDE_DIR - the GLEW include directories
# GLEW_LIBRARY # GLEW_LIBRARY - link these to use GLEW
# #
if(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
set(GLEW_FIND_QUIETLY TRUE)
endif(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
IF (WIN32) IF (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include $ENV{PROGRAMFILES}/GLEW/include
${PROJECT_SOURCE_DIR}/src/nvgl/glew/include ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
DOC "The directory where GL/glew.h resides") DOC "The directory where GL/glew.h resides")
@ -20,7 +24,7 @@ IF (WIN32)
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library") DOC "The GLEW library")
ELSE (WIN32) ELSE (WIN32)
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
/usr/include /usr/include
/usr/local/include /usr/local/include
/sw/include /sw/include
@ -29,19 +33,19 @@ ELSE (WIN32)
FIND_LIBRARY( GLEW_LIBRARY FIND_LIBRARY( GLEW_LIBRARY
NAMES GLEW glew NAMES GLEW glew
PATHS PATHS
/usr/lib64 /usr/lib32
/usr/lib /usr/lib
/usr/local/lib64 /usr/local/lib32
/usr/local/lib /usr/local/lib
/sw/lib /sw/lib
/opt/local/lib /opt/local/lib
DOC "The GLEW library") DOC "The GLEW library")
ENDIF (WIN32) ENDIF (WIN32)
IF (GLEW_INCLUDE_PATH) # handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") # all listed variables are TRUE
ELSE (GLEW_INCLUDE_PATH) include(FindPackageHandleStandardArgs)
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR)
ENDIF (GLEW_INCLUDE_PATH)
mark_as_advanced(GLEW_LIBRARY GLEW_INCLUDE_DIR)
MARK_AS_ADVANCED( GLEW_FOUND )

View File

@ -120,7 +120,7 @@ endif(JPEG_FOUND)
# GLEW # GLEW
if(GLEW_FOUND) if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_PATH}) include_directories(${GLEW_INCLUDE_DIR})
endif(GLEW_FOUND) endif(GLEW_FOUND)
# OpenGL # OpenGL