CMake: add resources to tests

Some tests -- notably the keyboard module -- need to have the
QRC for the module loaded as well (e.g. because of data in the
QRC). Add a RESOURCES parameter to calamares_add_test()
like calamares_add_plugin() already has, to build the
resources into the test.

Keyboard test now passes, since it was missing the data for
lookups before.
main
Adriaan de Groot 4 years ago
parent 2aece7ff1b
commit aeffbac9cd

@ -14,6 +14,7 @@
# calamares_add_test(
# <NAME>
# [GUI]
# [RESOURCES FILE]
# SOURCES <FILE..>
# )
@ -24,13 +25,14 @@ function( calamares_add_test )
# parse arguments (name needs to be saved before passing ARGN into the macro)
set( NAME ${ARGV0} )
set( options GUI )
set( oneValueArgs NAME RESOURCES )
set( multiValueArgs SOURCES LIBRARIES DEFINITIONS )
cmake_parse_arguments( TEST "${options}" "" "${multiValueArgs}" ${ARGN} )
cmake_parse_arguments( TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set( TEST_NAME ${NAME} )
if( ECM_FOUND AND BUILD_TESTING )
ecm_add_test(
${TEST_SOURCES}
${TEST_SOURCES} ${TEST_RESOURCES}
TEST_NAME
${TEST_NAME}
LINK_LIBRARIES
@ -44,5 +46,8 @@ function( calamares_add_test )
if( TEST_GUI )
target_link_libraries( ${TEST_NAME} calamaresui Qt5::Gui )
endif()
if( TEST_RESOURCES )
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
endif()
endif()
endfunction()

@ -27,4 +27,6 @@ calamares_add_test(
SOURCES
Tests.cpp
SetKeyboardLayoutJob.cpp
RESOURCES
keyboard.qrc
)

Loading…
Cancel
Save