diff --git a/cmake/modules/AppUtilities.cmake b/cmake/modules/AppUtilities.cmake index 2272431..bd93d92 100644 --- a/cmake/modules/AppUtilities.cmake +++ b/cmake/modules/AppUtilities.cmake @@ -86,10 +86,12 @@ function (add_appstream_file) 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(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}") + if (APPSTREAM_TESTS_ENABLED) + if (NOT APPSTREAMCLI_BIN) + 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 () endif () endfunction ()