Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/Findepoxy.cmake
- This file was added.
1 | # - Try to find libepoxy | ||||
---|---|---|---|---|---|
2 | # Once done this will define | ||||
3 | # | ||||
4 | # epoxy_FOUND - System has libepoxy | ||||
5 | # epoxy_LIBRARY - The libepoxy library | ||||
6 | # epoxy_INCLUDE_DIR - The libepoxy include dir | ||||
7 | # epoxy_DEFINITIONS - Compiler switches required for using libepoxy | ||||
8 | # epoxy_HAS_GLX - Whether GLX support is available | ||||
9 | | ||||
10 | # Copyright (c) 2014 Fredrik Höglund <fredrik@kde.org> | ||||
11 | # | ||||
12 | # Redistribution and use in source and binary forms, with or without | ||||
13 | # modification, are permitted provided that the following conditions | ||||
14 | # are met: | ||||
15 | # 1. Redistributions of source code must retain the above copyright | ||||
16 | # notice, this list of conditions and the following disclaimer. | ||||
17 | # 2. Redistributions in binary form must reproduce the above copyright | ||||
18 | # notice, this list of conditions and the following disclaimer in the | ||||
19 | # documentation and/or other materials provided with the distribution. | ||||
20 | # 3. Neither the name of the University nor the names of its contributors | ||||
21 | # may be used to endorse or promote products derived from this software | ||||
22 | # without specific prior written permission. | ||||
23 | # | ||||
24 | # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
25 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
26 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
27 | # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
28 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
29 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
30 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
31 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
32 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
33 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
34 | # SUCH DAMAGE. | ||||
35 | | ||||
36 | if (NOT WIN32) | ||||
37 | find_package(PkgConfig) | ||||
38 | pkg_check_modules(PKG_epoxy QUIET epoxy) | ||||
39 | | ||||
40 | set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS}) | ||||
41 | | ||||
42 | find_path(epoxy_INCLUDE_DIR NAMES epoxy/gl.h HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS}) | ||||
43 | find_library(epoxy_LIBRARY NAMES epoxy HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS}) | ||||
44 | find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR}) | ||||
45 | | ||||
46 | if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND") | ||||
47 | set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available") | ||||
48 | else () | ||||
49 | set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available") | ||||
50 | endif() | ||||
51 | | ||||
52 | include(FindPackageHandleStandardArgs) | ||||
53 | find_package_handle_standard_args(epoxy DEFAULT_MSG epoxy_LIBRARY epoxy_INCLUDE_DIR) | ||||
54 | | ||||
55 | mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY epoxy_HAS_GLX) | ||||
56 | endif() |