hyprwayland-scanner/hyprwayland-scanner-config.cmake.in
Yaroslav abbade08f1
cmake: add hyprwayland-scanner-config (#1)
This allows us to add wayland protocol dependencies to other cmake-based
projects with minimum extra code.

Example:

find_package(hyprwayland-scanner REQUIRED)
add_executable(target main.c)
hyprwayland_protocol(
    target
    "linux-dmabuf-v1"
    "${WAYLAND_PROTOCOLS}/linux-dmabuf/"
    "${CMAKE_SOURCE_DIR}/protocols"
)
2024-04-28 13:48:42 +01:00

15 lines
501 B
CMake

@PACKAGE_INIT@
set_and_check(BINDIR "@PACKAGE_CMAKE_INSTALL_BINDIR@")
function(hyprwayland_protocol targets protoName protoPath outputPath)
add_custom_command(
OUTPUT "${outputPath}/${protoName}.cpp"
COMMAND "${BINDIR}/hyprwayland-scanner" "${protoPath}/${protoName}.xml" "${outputPath}"
)
foreach(target ${targets})
target_sources(${target} PRIVATE "${outputPath}/${protoName}.cpp")
endforeach()
endfunction()
check_required_components(hyprwayland-scanner)