Warning, /frameworks/extra-cmake-modules/find-modules/Findepoxy.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2014 Fredrik Höglund <fredrik@kde.org>
0002 # SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005
0006 #[=======================================================================[.rst:
0007 Findepoxy
0008 ---------
0009
0010 Try to find libepoxy on a Unix system.
0011
0012 This will define the following variables:
0013
0014 ``epoxy_FOUND``
0015 True if (the requested version of) libepoxy is available
0016 ``epoxy_VERSION``
0017 The version of libepoxy
0018 ``epoxy_LIBRARIES``
0019 This should be passed to target_link_libraries() if the target is not
0020 used for linking
0021 ``epoxy_INCLUDE_DIRS``
0022 This should be passed to target_include_directories() if the target is not
0023 used for linking
0024 ``epoxy_DEFINITIONS``
0025 This should be passed to target_compile_options() if the target is not
0026 used for linking
0027 ``epoxy_HAS_GLX``
0028 True if GLX support is available
0029
0030 If ``epoxy_FOUND`` is TRUE, it will also define the following imported target:
0031
0032 ``epoxy::epoxy``
0033 The epoxy library
0034
0035 In general we recommend using the imported target, as it is easier to use.
0036 Bear in mind, however, that if the target is in the link interface of an
0037 exported library, it must be made available by the package config file.
0038 #]=======================================================================]
0039
0040 find_package(PkgConfig QUIET)
0041 pkg_check_modules(PKG_epoxy QUIET epoxy)
0042
0043 set(epoxy_VERSION ${PKG_epoxy_VERSION})
0044 set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS})
0045
0046 find_path(epoxy_INCLUDE_DIRS
0047 NAMES epoxy/gl.h
0048 HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS}
0049 )
0050 find_library(epoxy_LIBRARIES
0051 NAMES epoxy
0052 HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS}
0053 )
0054 find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR})
0055
0056 if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND")
0057 set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available")
0058 else ()
0059 set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available")
0060 endif()
0061
0062 include(FindPackageHandleStandardArgs)
0063 find_package_handle_standard_args(epoxy
0064 FOUND_VAR epoxy_FOUND
0065 REQUIRED_VARS epoxy_LIBRARIES epoxy_INCLUDE_DIRS
0066 VERSION_VAR epoxy_VERSION
0067 )
0068
0069 if (epoxy_FOUND AND NOT TARGET epoxy::epoxy)
0070 add_library(epoxy::epoxy UNKNOWN IMPORTED)
0071 set_target_properties(epoxy::epoxy PROPERTIES
0072 IMPORTED_LOCATION "${epoxy_LIBRARIES}"
0073 INTERFACE_COMPILE_OPTIONS "${epoxy_DEFINITIONS}"
0074 INTERFACE_INCLUDE_DIRECTORIES "${epoxy_INCLUDE_DIRS}"
0075 )
0076 endif()
0077
0078 mark_as_advanced(
0079 epoxy_DEFINITIONS
0080 epoxy_HAS_GLX
0081 epoxy_INCLUDE_DIRS
0082 epoxy_LIBRARIES
0083 epoxy_VERSION
0084 )