cmake: use find_program() to locate wayland-scanner binary

This commit is contained in:
Daniel Eklöf 2019-02-13 21:45:31 +01:00
parent 236511db88
commit 4d9ee6ff82

View file

@ -8,6 +8,11 @@ endif ()
# Wayland/wlroots bar backend # Wayland/wlroots bar backend
if (ENABLE_WAYLAND) if (ENABLE_WAYLAND)
find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner)
if (WAYLAND_SCANNER_EXECUTABLE-NOTFOUND)
message(FATAL_ERROR "could not find wayland-scanner")
endif ()
function (wayland_protocol _deps) function (wayland_protocol _deps)
set(deps "") set(deps "")
foreach (xml_file ${ARGN}) foreach (xml_file ${ARGN})
@ -17,13 +22,13 @@ if (ENABLE_WAYLAND)
add_custom_command( add_custom_command(
OUTPUT ${out_h} OUTPUT ${out_h}
COMMAND wayland-scanner client-header < ${xml_file} > ${out_h} COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${xml_file} > ${out_h}
VERBATIM VERBATIM
MAIN_DEPENDENCY ${xml_file} MAIN_DEPENDENCY ${xml_file}
) )
add_custom_command( add_custom_command(
OUTPUT ${out_c} OUTPUT ${out_c}
COMMAND wayland-scanner private-code < ${xml_file} > ${out_c} COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code < ${xml_file} > ${out_c}
VERBATIM VERBATIM
MAIN_DEPENDENCY ${xml_file} MAIN_DEPENDENCY ${xml_file}
) )