dolphin/CMakeTests/FindGLEW.cmake
Glenn Rice a3d86ceead When checking for glew via cmake check to see that the system version of glew
is at least 1.8 and has the methods of glew 1.9.  This is an annoying
hack to deal with Ubuntu's glew setup, which is glew 1.8 with 1.9
methods patched in.
2013-09-07 12:24:32 -05:00

36 lines
845 B
CMake

include(FindPkgConfig OPTIONAL)
# This is a hack to deal with Ubuntu's mess.
# Ubuntu's version of glew is 1.8, but they have patched in most of glew 1.9.
# So Ubuntu's version works for dolphin.
macro(test_glew)
set(CMAKE_REQUIRED_INCLUDES ${GLEW_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES GLEW)
check_cxx_source_runs("
#include <GL/glew.h>
int main()
{
#ifdef GLEW_ARB_shader_image_load_store
return 0;
#else
return 1;
#endif
}"
GLEW_HAS_1_9_METHODS)
endmacro()
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
pkg_search_module(GLEW REQUIRED glew>=1.8)
endif()
if(GLEW_FOUND)
test_glew()
if (GLEW_HAS_1_9_METHODS)
include_directories(${GLEW_INCLUDE_DIRS})
message("GLEW found")
else()
set($GLEW_FOUND 0 CACHE INTERNAL "")
message(FATAL_ERROR "A version of GLEW with the required methods was not found")
endif()
endif()