Warning, /plasma/kwin/cmake/modules/FindLibdrm.cmake is written in an unsupported language. File is not indexed.

0001 #.rst:
0002 # FindLibdrm
0003 # -------
0004 #
0005 # Try to find libdrm on a Unix system.
0006 #
0007 # This will define the following variables:
0008 #
0009 # ``Libdrm_FOUND``
0010 #     True if (the requested version of) libdrm is available
0011 # ``Libdrm_VERSION``
0012 #     The version of libdrm
0013 # ``Libdrm_LIBRARIES``
0014 #     This can be passed to target_link_libraries() instead of the ``Libdrm::Libdrm``
0015 #     target
0016 # ``Libdrm_INCLUDE_DIRS``
0017 #     This should be passed to target_include_directories() if the target is not
0018 #     used for linking
0019 # ``Libdrm_DEFINITIONS``
0020 #     This should be passed to target_compile_options() if the target is not
0021 #     used for linking
0022 #
0023 # If ``Libdrm_FOUND`` is TRUE, it will also define the following imported target:
0024 #
0025 # ``Libdrm::Libdrm``
0026 #     The libdrm library
0027 #
0028 # In general we recommend using the imported target, as it is easier to use.
0029 # Bear in mind, however, that if the target is in the link interface of an
0030 # exported library, it must be made available by the package config file.
0031 
0032 #=============================================================================
0033 # SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
0034 # SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0035 #
0036 # SPDX-License-Identifier: BSD-3-Clause
0037 #=============================================================================
0038 
0039 if(CMAKE_VERSION VERSION_LESS 2.8.12)
0040     message(FATAL_ERROR "CMake 2.8.12 is required by FindLibdrm.cmake")
0041 endif()
0042 if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
0043     message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindLibdrm.cmake")
0044 endif()
0045 
0046 if(NOT WIN32)
0047     # Use pkg-config to get the directories and then use these values
0048     # in the FIND_PATH() and FIND_LIBRARY() calls
0049     find_package(PkgConfig)
0050     pkg_check_modules(PKG_Libdrm QUIET libdrm)
0051 
0052     set(Libdrm_DEFINITIONS ${PKG_Libdrm_CFLAGS_OTHER})
0053     set(Libdrm_VERSION ${PKG_Libdrm_VERSION})
0054 
0055     find_path(Libdrm_INCLUDE_DIR
0056         NAMES
0057             xf86drm.h
0058         HINTS
0059             ${PKG_Libdrm_INCLUDE_DIRS}
0060     )
0061     find_library(Libdrm_LIBRARY
0062         NAMES
0063             drm
0064         HINTS
0065             ${PKG_Libdrm_LIBRARY_DIRS}
0066     )
0067 
0068     include(FindPackageHandleStandardArgs)
0069     find_package_handle_standard_args(Libdrm
0070         FOUND_VAR
0071             Libdrm_FOUND
0072         REQUIRED_VARS
0073             Libdrm_LIBRARY
0074             Libdrm_INCLUDE_DIR
0075         VERSION_VAR
0076             Libdrm_VERSION
0077     )
0078 
0079     if(Libdrm_FOUND AND NOT TARGET Libdrm::Libdrm)
0080         add_library(Libdrm::Libdrm UNKNOWN IMPORTED)
0081         set_target_properties(Libdrm::Libdrm PROPERTIES
0082             IMPORTED_LOCATION "${Libdrm_LIBRARY}"
0083             INTERFACE_COMPILE_OPTIONS "${Libdrm_DEFINITIONS}"
0084             INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}"
0085             INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/libdrm"
0086         )
0087     endif()
0088 
0089     mark_as_advanced(Libdrm_LIBRARY Libdrm_INCLUDE_DIR)
0090 
0091     # compatibility variables
0092     set(Libdrm_LIBRARIES ${Libdrm_LIBRARY})
0093     set(Libdrm_INCLUDE_DIRS ${Libdrm_INCLUDE_DIR} "${Libdrm_INCLUDE_DIR}/libdrm")
0094     set(Libdrm_VERSION_STRING ${Libdrm_VERSION})
0095 
0096 else()
0097     message(STATUS "FindLibdrm.cmake cannot find libdrm on Windows systems.")
0098     set(Libdrm_FOUND FALSE)
0099 endif()
0100 
0101 include(FeatureSummary)
0102 set_package_properties(Libdrm PROPERTIES
0103     URL "https://wiki.freedesktop.org/dri/"
0104     DESCRIPTION "Userspace interface to kernel DRM services"
0105 )