CMake: drop NAME option from add_test
- drop the unused "NAME" option for calamares_add_test - while here reformat the module with the CMake style tool
This commit is contained in:
parent
a27b72e893
commit
5975ff9e42
@ -18,19 +18,17 @@
|
||||
# SOURCES <FILE..>
|
||||
# )
|
||||
|
||||
include( CMakeParseArguments )
|
||||
include( CalamaresAutomoc )
|
||||
include(CMakeParseArguments)
|
||||
include(CalamaresAutomoc)
|
||||
|
||||
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}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
set( TEST_NAME ${NAME} )
|
||||
function(calamares_add_test name)
|
||||
set(options GUI)
|
||||
set(oneValueArgs RESOURCES)
|
||||
set(multiValueArgs SOURCES LIBRARIES DEFINITIONS)
|
||||
cmake_parse_arguments(TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
set(TEST_NAME ${name})
|
||||
|
||||
if( ECM_FOUND AND BUILD_TESTING )
|
||||
if(ECM_FOUND AND BUILD_TESTING)
|
||||
ecm_add_test(
|
||||
${TEST_SOURCES} ${TEST_RESOURCES}
|
||||
TEST_NAME
|
||||
@ -40,15 +38,18 @@ function( calamares_add_test )
|
||||
${TEST_LIBRARIES}
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
)
|
||||
)
|
||||
calamares_automoc( ${TEST_NAME} )
|
||||
# We specifically pass in the source directory of the test-being-
|
||||
# compiled, so that it can find test-files in that source dir.
|
||||
target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} )
|
||||
if( TEST_GUI )
|
||||
target_link_libraries( ${TEST_NAME} Calamares::calamaresui Qt5::Gui )
|
||||
target_compile_definitions(
|
||||
${TEST_NAME}
|
||||
PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS}
|
||||
)
|
||||
if(TEST_GUI)
|
||||
target_link_libraries(${TEST_NAME} Calamares::calamaresui Qt5::Gui)
|
||||
endif()
|
||||
if( TEST_RESOURCES )
|
||||
if(TEST_RESOURCES)
|
||||
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user