Expose test name (created via `TestTarget.cmake`) for fixing downstream bug
This allows to set test properties in other projects as needed to fix https://github.com/Martchus/syncthingtray/issues/116.
This commit is contained in:
parent
5509caff89
commit
5563776061
|
@ -115,7 +115,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
|||
set(META_APP_DESCRIPTION "Useful C++ classes and routines such as argument parser, IO and conversion utilities")
|
||||
set(META_VERSION_MAJOR 5)
|
||||
set(META_VERSION_MINOR 11)
|
||||
set(META_VERSION_PATCH 2)
|
||||
set(META_VERSION_PATCH 3)
|
||||
|
||||
# find required 3rd party libraries
|
||||
include(3rdParty)
|
||||
|
|
|
@ -154,6 +154,8 @@ configure_test_target(
|
|||
"${TEST_SRC_FILES}"
|
||||
LIBRARIES
|
||||
"${TEST_LIBRARIES}"
|
||||
FULL_TEST_NAME_OUT_VAR
|
||||
META_MAIN_TEST_NAME
|
||||
RUN_ARGS
|
||||
"${RUN_TESTS_ARGS}"
|
||||
${TEST_TARGET_OPTIONS})
|
||||
|
|
|
@ -16,7 +16,7 @@ option(EXCLUDE_TESTS_FROM_ALL "specifies whether to exclude tests from the 'all'
|
|||
function (configure_test_target)
|
||||
# parse arguments
|
||||
set(OPTIONAL_ARGS MANUAL)
|
||||
set(ONE_VALUE_ARGS TARGET_NAME TEST_NAME)
|
||||
set(ONE_VALUE_ARGS TARGET_NAME TEST_NAME FULL_TEST_NAME_OUT_VAR)
|
||||
set(MULTI_VALUE_ARGS HEADER_FILES SRC_FILES LIBRARIES RUN_ARGS)
|
||||
cmake_parse_arguments(ARGS "${OPTIONAL_ARGS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN})
|
||||
if (NOT ARGS_TARGET_NAME)
|
||||
|
@ -70,7 +70,11 @@ function (configure_test_target)
|
|||
|
||||
# make the test recognized by ctest
|
||||
if (NOT ARGS_MANUAL)
|
||||
add_test(NAME "${ARGS_TARGET_NAME}_run_${ARGS_TEST_NAME}" COMMAND "${TEST_TARGET_NAME}" ${RUN_ARGS})
|
||||
set(FULL_TEST_NAME "${ARGS_TARGET_NAME}_run_${ARGS_TEST_NAME}")
|
||||
set("${FULL_TEST_NAME_OUT_VAR}"
|
||||
"${FULL_TEST_NAME}"
|
||||
PARENT_SCOPE)
|
||||
add_test(NAME "${FULL_TEST_NAME}" COMMAND "${TEST_TARGET_NAME}" ${RUN_ARGS})
|
||||
endif ()
|
||||
|
||||
# add the test executable to the dependencies of the check target
|
||||
|
|
Loading…
Reference in New Issue