From b3d195f0188758a14875a5a2f270e4fd190a679f Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 17 Apr 2018 00:15:38 +0200 Subject: sync with upstream --- cmake/modules/FindWaylandpp.cmake | 73 +++++++++++++-------------------------- 1 file changed, 24 insertions(+), 49 deletions(-) (limited to 'cmake/modules/FindWaylandpp.cmake') diff --git a/cmake/modules/FindWaylandpp.cmake b/cmake/modules/FindWaylandpp.cmake index 8a1cd74..336e613 100644 --- a/cmake/modules/FindWaylandpp.cmake +++ b/cmake/modules/FindWaylandpp.cmake @@ -1,64 +1,39 @@ # FindWaylandpp -# ----------- +# ------------- # Finds the waylandpp library # # This will will define the following variables:: # -# WAYLANDPP_FOUND - the system has Wayland -# WAYLANDPP_INCLUDE_DIRS - the Wayland include directory -# WAYLANDPP_LIBRARIES - the Wayland libraries -# WAYLANDPP_DEFINITIONS - the Wayland definitions - - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_WAYLANDPP wayland-client++>=0.1 wayland-egl++ wayland-cursor++ wayland-scanner++ QUIET) - pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols>=1.7 QUIET) - # TODO: Remove check when CMake minimum version is bumped globally - if(CMAKE_VERSION VERSION_EQUAL 3.4.0 OR CMAKE_VERSION VERSION_GREATER 3.4.0) - if(PC_WAYLANDPP_FOUND) - pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) - endif() - if(PC_WAYLAND_PROTOCOLS_FOUND) - pkg_get_variable(PC_WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) - endif() - endif() +# WAYLANDPP_FOUND - the system has waylandpp +# WAYLANDPP_INCLUDE_DIRS - the waylandpp include directory +# WAYLANDPP_LIBRARIES - the waylandpp libraries +# WAYLANDPP_DEFINITIONS - the waylandpp definitions +# WAYLANDPP_SCANNER - path to wayland-scanner++ + +pkg_check_modules(WAYLANDPP wayland-client++ wayland-egl++ wayland-cursor++) +pkg_check_modules(PC_WAYLANDPP_SCANNER wayland-scanner++) +if(WAYLANDPP_FOUND) + pkg_get_variable(PC_WAYLANDPP_PKGDATADIR wayland-client++ pkgdatadir) +endif() +if(PC_WAYLANDPP_SCANNER_FOUND) + pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp) endif() -find_path(WAYLANDPP_INCLUDE_DIR NAMES wayland-client.hpp - PATHS ${PC_WAYLANDPP_INCLUDE_DIRS}) - -find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_library(WAYLANDPP_EGL_LIBRARY NAMES wayland-egl++ - PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS}) - -find_program(WAYLANDPP_SCANNER NAMES wayland-scanner++ - PATHS ${PC_WAYLANDPP_SCANNER}) +# Promote to cache variables so all code can access it +set(WAYLANDPP_PROTOCOLS_DIR "${PC_WAYLANDPP_PKGDATADIR}/protocols" CACHE INTERNAL "") -find_path(WAYLAND_PROTOCOLS_DIR NAMES unstable/xdg-shell/xdg-shell-unstable-v6.xml - PATHS ${PC_WAYLAND_PROTOCOLS_DIR} - DOC "Directory containing additional Wayland protocols") +# wayland-scanner++ is from native/host system in case of cross-compilation, so +# it's ok if we don't find it with pkgconfig +find_program(WAYLANDPP_SCANNER wayland-scanner++ PATHS ${PC_WAYLANDPP_SCANNER}) include (FindPackageHandleStandardArgs) find_package_handle_standard_args (Waylandpp REQUIRED_VARS - WAYLANDPP_INCLUDE_DIR - WAYLANDPP_CLIENT_LIBRARY - WAYLANDPP_CURSOR_LIBRARY - WAYLANDPP_EGL_LIBRARY + WAYLANDPP_FOUND WAYLANDPP_SCANNER - WAYLAND_PROTOCOLS_DIR VERSION_VAR - PC_WAYLANDPP_wayland-client++_VERSION) - -if (WAYLANDPP_FOUND) - set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY} ${WAYLANDPP_CURSOR_LIBRARY} ${WAYLANDPP_EGL_LIBRARY}) - set(WAYLANDPP_INCLUDE_DIRS ${PC_WAYLANDPP_INCLUDE_DIRS}) - set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) -endif() + WAYLANDPP_wayland-client++_VERSION) -mark_as_advanced (WAYLANDPP_CLIENT_LIBRARY WAYLANDPP_CURSOR_LIBRARY WAYLANDPP_EGL_LIBRARY WAYLANDPP_INCLUDE_DIR) +set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1) +# Also pass on library directories +set(WAYLANDPP_LIBRARIES ${WAYLANDPP_LDFLAGS}) -- cgit v1.2.3