Enable AppStream tests only by default via `ENABLE_DEVEL_DEFAULTS`

This test already fails on deprecations so it is likely not a good idea to
run it in general as it would cause needless failures.
This commit is contained in:
Martchus 2023-11-22 12:59:20 +01:00
parent a1bed55eda
commit 8fb7de6fe0
1 changed files with 6 additions and 1 deletions

View File

@ -80,9 +80,14 @@ function (add_appstream_file)
COMPONENT appimage)
# add test
set(APPSTREAM_TESTS_ENABLED_DEFAULT OFF)
find_program(APPSTREAMCLI_BIN "appstreamcli")
if (ENABLE_DEVEL_DEFAULTS AND APPSTREAMCLI_BIN)
set(APPSTREAM_TESTS_ENABLED_DEFAULT ON)
endif ()
option(APPSTREAM_TESTS_ENABLED "enables tests for checking whether AppStream files" "${APPSTREAM_TESTS_ENABLED_DEFAULT}")
if (NOT APPSTREAMCLI_BIN)
message(STATUS "Could not find appstreamcli; won't add test/target to validate appstream files")
message(FATAL_ERROR "Unable to validate appstreamcli files; appstreamcli not found")
else ()
add_test(NAME "${META_TARGET_NAME}_appstream_validation" COMMAND "${APPSTREAMCLI_BIN}" validate "${APPSTREAM_FILE}")
endif ()