1find_package(PkgConfig) 2 3pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) 4 5execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols 6 OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR 7 RESULT_VARIABLE _pkgconfig_failed) 8if (_pkgconfig_failed) 9 message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") 10endif() 11 12string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") 13 14find_package_handle_standard_args(WaylandProtocols 15 FOUND_VAR 16 WaylandProtocols_FOUND 17 REQUIRED_VARS 18 WaylandProtocols_PKGDATADIR 19 VERSION_VAR 20 WaylandProtocols_VERSION 21 HANDLE_COMPONENTS 22) 23 24set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) 25set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) 26set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) 27