FindGLX.cmake 1.98 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
############################################################################
# FindGLX.txt
# Copyright (C) 2014  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################
#
# - Find the GLX include file and library
#
#  GLX_FOUND - system has GLX
#  GLX_INCLUDE_DIRS - the GLX include directory
#  GLX_LIBRARIES - The libraries needed to use GLX

include(CheckIncludeFile)
include(CheckSymbolExists)

set(_GLX_ROOT_PATHS
	${WITH_GLX}
	${CMAKE_INSTALL_PREFIX}
)

find_path(GLX_INCLUDE_DIRS
	NAMES GL/gl.h
	HINTS _GLX_ROOT_PATHS
	PATH_SUFFIXES include
)
if(GLX_INCLUDE_DIRS)
	check_include_file(GL/gl.h HAVE_GL_GL_H)
	check_include_file(GL/glx.h HAVE_GL_GLX_H)
endif()

find_library(GL_LIBRARY
	NAMES GL
	HINTS _GLX_ROOT_PATHS
	PATH_SUFFIXES bin lib
)
find_library(GLEW_LIBRARY
	NAMES GLEW
	HINTS _GLX_ROOT_PATHS
	PATH_SUFFIXES bin lib
)
set(GLX_LIBRARIES ${GL_LIBRARY} ${GLEW_LIBRARY})

if(GLX_LIBRARIES)
	# TODO: check symbols in gl and glew
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLX
	DEFAULT_MSG
	GLX_INCLUDE_DIRS HAVE_GL_GL_H HAVE_GL_GLX_H GLX_LIBRARIES
)

mark_as_advanced(GLX_INCLUDE_DIRS HAVE_GL_GL_H HAVE_GL_GLX_H GLX_LIBRARIES)