Commit eb6df4fb authored by Lukas Riedel's avatar Lukas Riedel

Link Google Test to unit meta-ini tests as well

Disable coverage reports on meta-ini tests as it was done for regular
unit tests already.
parent 099cb9f5
......@@ -108,6 +108,13 @@ endfunction()
# Registers the created tests as unit tests, including coverage flags.
# If not specified, the tests are registered as system tests.
#
# .. cmake_param:: CUSTOM_MAIN
# :option:
#
# Write a custom `main()` function for the unit test executables instead
# of generating a default one automatically. Only applies if UNIT_TEST
# is enabled.
#
# .. cmake_param:: TARGET
# :single:
#
......@@ -153,7 +160,7 @@ endfunction()
# executable will be linked to the libraries DORiE depends on.
#
function(dorie_add_metaini_test)
set(OPTIONS UNIT_TEST)
set(OPTIONS UNIT_TEST CUSTOM_MAIN)
set(SINGLE TARGET METAINI SCRIPT BASENAME CREATED_TARGETS)
cmake_parse_arguments(SYSTEM_TEST "${OPTIONS}" "${SINGLE}" "" ${ARGN})
......@@ -161,6 +168,11 @@ function(dorie_add_metaini_test)
message(SEND_ERROR "No meta ini file given!")
endif()
if(SYSTEM_TEST_CUSTOM_MAIN AND NOT SYSTEM_TEST_UNIT_TEST)
message(WARNING "Ignoring option CUSTOM_MAIN because option UNIT_TEST "
"was not enabled")
endif()
# configure meta ini file or just copy.
get_filename_component(metaini-name ${SYSTEM_TEST_METAINI} NAME_WE)
get_filename_component(metaini-extension ${SYSTEM_TEST_METAINI} EXT)
......@@ -212,8 +224,14 @@ function(dorie_add_metaini_test)
# add dependencies and flags
if(SYSTEM_TEST_UNIT_TEST)
add_coverage_links(${created_targets})
# add_coverage_links(${created_targets})
add_dependencies(build_unit_tests ${created_targets})
if (SYSTEM_TEST_CUSTOM_MAIN)
target_link_libraries(${created_targets} gtest)
else ()
target_link_libraries(${created_targets} gtest_main)
endif()
else()
add_dependencies(build_system_tests ${created_targets})
endif()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment