Skip to content
  • Sponsor aminya/project_options

  • Notifications You must be signed in to change notification settings
  • Fork 56
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a wrapper module for add_test #240

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Forbid multiple call of add test wrappers
FeignClaims committed Mar 1, 2024
commit 16fa82bbfddf8d81913d44a8d8f0801389bf6bb2
24 changes: 7 additions & 17 deletions src/Tests.cmake
Original file line number Diff line number Diff line change
@@ -31,10 +31,7 @@ function(_configure_target target_name type)
add_executable(${target_name})
set(scope PRIVATE)
elseif(${type} STREQUAL "test_config")
if(NOT TARGET ${target_name})
add_library(${target_name} INTERFACE)
endif()

add_library(${target_name} INTERFACE)
set(scope INTERFACE)
endif()

@@ -107,22 +104,15 @@ endfunction()
This function generates a INTERFACE library named ``test_config.<config_name>``,
so ``add_library_test`` and ``add_executable_test`` can simply reuse test configs.

You can call this function with the same ``<config_name>`` multiple times
to add more args.
To avoid confusion (the name says ``add``), you can't call this function with the
same ``<config_name>`` multiple times to add more args.

.. code:: cmake

add_test_config(common
COMPILE_DEFINITIONS
BOOST_UT_DISABLE_MODULE=1
)
add_test_config(common
DEPENDENCIES_CONFIG
ut

LIBRARIES
boost-ext-ut::ut
)

]]
function(add_test_config config_name)
@@ -231,8 +221,8 @@ this target using ``add_test``.
``test_config.<config_name>``. If multiple configs are given, they will be
merged.

you can't call this function with the same ``<library>`` and ``<test_name>``
multiple times to add more args.
To avoid confusion (the name says ``add``), you can't call this function with
the same ``<library>`` and ``<test_name>`` multiple times to add more args.

.. code:: cmake

@@ -344,8 +334,8 @@ runs the ``<executable>`` using ``EXECUTE_ARGS``.
``test_config.<config_name>``. If multiple configs are given, they will be
merged.

You can't call this function with the same ``<executable>`` and ``<test_name>``
multiple times to add more args.
To avoid confusion (the name says ``add``), You can't call this function with
the same ``<executable>`` and ``<test_name>`` multiple times to add more args.

.. code:: cmake