-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathFindO2GPUWayland.cmake
More file actions
51 lines (43 loc) · 2.5 KB
/
FindO2GPUWayland.cmake
File metadata and controls
51 lines (43 loc) · 2.5 KB
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
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
set(PKGNAME ${CMAKE_FIND_PACKAGE_NAME})
string(TOUPPER ${PKGNAME} PKGENVNAME)
find_path(${PKGNAME}_INCLUDE_DIR
NAMES wayland-client.h)
find_path(${PKGNAME}_XKBCOMMON_INCLUDE_DIR
NAMES xkbcommon/xkbcommon.h)
find_library(${PKGNAME}_LIBRARY_SHARED
NAMES wayland-client libwayland-client)
find_library(${PKGNAME}_XKBCOMMON_LIBRARY_SHARED
NAMES xkbcommon libxkbcommon)
find_program(${PKGNAME}_SCANNER wayland-scanner)
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_get_variable(${PKGNAME}_PROTOCOLS_DIR wayland-protocols pkgdatadir)
if(NOT ${PKGNAME}_PROTOCOLS_DIR OR NOT EXISTS "${${PKGNAME}_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml" OR NOT EXISTS "${${PKGNAME}_PROTOCOLS_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml")
message(STATUS "wayland xdg protocol missing in ${${PKGNAME}_PROTOCOLS_DIR}")
unset(${PKGNAME}_PROTOCOLS_DIR)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(${PKGNAME}
REQUIRED_VARS ${PKGNAME}_LIBRARY_SHARED ${PKGNAME}_XKBCOMMON_LIBRARY_SHARED ${PKGNAME}_INCLUDE_DIR ${PKGNAME}_XKBCOMMON_INCLUDE_DIR ${PKGNAME}_SCANNER ${PKGNAME}_PROTOCOLS_DIR)
if(${PKGNAME}_LIBRARY_SHARED AND ${PKGNAME}_XKBCOMMON_LIBRARY_SHARED AND ${PKGNAME}_INCLUDE_DIR AND ${PKGNAME}_XKBCOMMON_INCLUDE_DIR AND ${PKGNAME}_SCANNER AND ${PKGNAME}_PROTOCOLS_DIR)
add_library(WAYLAND-all_libraries INTERFACE)
target_link_libraries(WAYLAND-all_libraries INTERFACE ${${PKGNAME}_LIBRARY_SHARED} ${${PKGNAME}_XKBCOMMON_LIBRARY_SHARED})
set_target_properties(WAYLAND-all_libraries PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${${PKGNAME}_INCLUDE_DIR}
INTERFACE_INCLUDE_DIRECTORIES ${${PKGNAME}_XKBCOMMON_INCLUDE_DIR})
add_library(GPUWayland::wayland-client ALIAS WAYLAND-all_libraries)
endif()
mark_as_advanced(${PKGNAME}_LIBRARY_SHARED ${PKGNAME}_INCLUDE_DIR ${PKGNAME}_SCANNER ${PKGNAME}_PROTOCOLS_DIR)
unset(PKGNAME)
unset(PKGENVNAME)