| 1 | find_package(PkgConfig) |
| 2 | |
| 3 | pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) |
| 4 | |
| 5 | execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols |
| 6 | OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR |
| 7 | RESULT_VARIABLE _pkgconfig_failed) |
| 8 | if (_pkgconfig_failed) |
| 9 | message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") |
| 10 | endif() |
| 11 | |
| 12 | string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") |
| 13 | |
| 14 | find_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 | |
| 24 | set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) |
| 25 | set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) |
| 26 | set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) |