Blame cmake/FindWayland.cmake

Packit 1fb8d4
# - Finds Wayland
Packit 1fb8d4
# Find the Wayland libraries that are needed for UWAC
Packit 1fb8d4
#
Packit 1fb8d4
#  This module defines the following variables:
Packit 1fb8d4
#     WAYLAND_FOUND     - true if UWAC has been found
Packit 1fb8d4
#     WAYLAND_LIBS      - Set to the full path to wayland client libraries
Packit 1fb8d4
#     WAYLAND_INCLUDE_DIR - Set to the include directories for wayland
Packit 1fb8d4
#     XKBCOMMON_LIBS      - Set to the full path to xkbcommon libraries
Packit 1fb8d4
#     XKBCOMMON_INCLUDE_DIR - Set to the include directories for xkbcommon
Packit 1fb8d4
#
Packit 1fb8d4
Packit 1fb8d4
#=============================================================================
Packit 1fb8d4
# Copyright 2015 David Fort <contact@hardening-consulting.com>
Packit 1fb8d4
#
Packit 1fb8d4
# Licensed under the Apache License, Version 2.0 (the "License");
Packit 1fb8d4
# you may not use this file except in compliance with the License.
Packit 1fb8d4
# You may obtain a copy of the License at
Packit 1fb8d4
#
Packit 1fb8d4
#     http://www.apache.org/licenses/LICENSE-2.0
Packit 1fb8d4
#
Packit 1fb8d4
# Unless required by applicable law or agreed to in writing, software
Packit 1fb8d4
# distributed under the License is distributed on an "AS IS" BASIS,
Packit 1fb8d4
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1fb8d4
# See the License for the specific language governing permissions and
Packit 1fb8d4
# limitations under the License.
Packit 1fb8d4
#=============================================================================
Packit 1fb8d4
Packit 1fb8d4
include(FindPkgConfig)
Packit 1fb8d4
Packit 1fb8d4
if(PKG_CONFIG_FOUND)
Packit 1fb8d4
    pkg_check_modules(WAYLAND_SCANNER_PC wayland-scanner)
Packit 1fb8d4
    pkg_check_modules(WAYLAND_CLIENT_PC wayland-client)
Packit Service 5a9772
		pkg_check_modules(WAYLAND_CURSOR_PC wayland-cursor)
Packit 1fb8d4
    pkg_check_modules(XKBCOMMON_PC xkbcommon)
Packit 1fb8d4
endif()
Packit 1fb8d4
Packit 1fb8d4
find_program(WAYLAND_SCANNER wayland-scanner
Packit 1fb8d4
    HINTS "${WAYLAND_SCANNER_PC_PREFIX}/bin"
Packit 1fb8d4
)
Packit 1fb8d4
Packit 1fb8d4
find_path(WAYLAND_INCLUDE_DIR wayland-client.h
Packit 1fb8d4
    HINTS ${WAYLAND_CLIENT_PC_INCLUDE_DIRS}
Packit 1fb8d4
)
Packit 1fb8d4
Packit Service 5a9772
find_library(WAYLAND_CLIENT_LIB
Packit 1fb8d4
    NAMES "wayland-client"
Packit 1fb8d4
    HINTS "${WAYLAND_CLIENT_PC_LIBRARY_DIRS}"
Packit 1fb8d4
)
Packit 1fb8d4
Packit Service 5a9772
find_library(WAYLAND_CURSOR_LIB
Packit Service 5a9772
    NAMES "wayland-cursor"
Packit Service 5a9772
		HINTS "${WAYLAND_CURSOR_PC_LIBRARY_DIRS}"
Packit Service 5a9772
)
Packit Service 5a9772
Packit Service 5a9772
if (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
Packit Service 5a9772
	list(APPEND WAYLAND_LIBS ${WAYLAND_CLIENT_LIB} ${WAYLAND_CURSOR_LIB})
Packit Service 5a9772
endif (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
Packit Service 5a9772
Packit 1fb8d4
find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
Packit 1fb8d4
    HINTS ${XKBCOMMON_PC_INCLUDE_DIRS}
Packit 1fb8d4
)
Packit 1fb8d4
Packit 1fb8d4
find_library(XKBCOMMON_LIBS
Packit 1fb8d4
    NAMES xkbcommon
Packit 1fb8d4
    HINTS "${XKBCOMMON_PC_LIBRARY_DIRS}"
Packit 1fb8d4
)
Packit 1fb8d4
Packit 1fb8d4
include(FindPackageHandleStandardArgs)
Packit 1fb8d4
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_SCANNER WAYLAND_INCLUDE_DIR WAYLAND_LIBS XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBS)