Skip to content

Commit 3228cb9

Browse files
committed
Forbid multiple call of add test wrappers
1 parent 0b55283 commit 3228cb9

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

src/Tests.cmake

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ function(_configure_target target_name type)
3131
add_executable(${target_name})
3232
set(scope PRIVATE)
3333
elseif(${type} STREQUAL "test_config")
34-
if(NOT TARGET ${target_name})
35-
add_library(${target_name} INTERFACE)
36-
endif()
37-
34+
add_library(${target_name} INTERFACE)
3835
set(scope INTERFACE)
3936
endif()
4037

@@ -107,22 +104,15 @@ endfunction()
107104
This function generates a INTERFACE library named ``test_config.<config_name>``,
108105
so ``add_library_test`` and ``add_executable_test`` can simply reuse test configs.
109106
110-
You can call this function with the same ``<config_name>`` multiple times
111-
to add more args.
107+
To avoid confusion (the name says ``add``), you can't call this function with the
108+
same ``<config_name>`` multiple times to add more args.
112109
113110
.. code:: cmake
114111
115112
add_test_config(common
116113
COMPILE_DEFINITIONS
117114
BOOST_UT_DISABLE_MODULE=1
118115
)
119-
add_test_config(common
120-
DEPENDENCIES_CONFIG
121-
ut
122-
123-
LIBRARIES
124-
boost-ext-ut::ut
125-
)
126116
127117
]]
128118
function(add_test_config config_name)
@@ -231,8 +221,8 @@ this target using ``add_test``.
231221
``test_config.<config_name>``. If multiple configs are given, they will be
232222
merged.
233223
234-
you can't call this function with the same ``<library>`` and ``<test_name>``
235-
multiple times to add more args.
224+
To avoid confusion (the name says ``add``), you can't call this function with
225+
the same ``<library>`` and ``<test_name>`` multiple times to add more args.
236226
237227
.. code:: cmake
238228
@@ -344,8 +334,8 @@ runs the ``<executable>`` using ``EXECUTE_ARGS``.
344334
``test_config.<config_name>``. If multiple configs are given, they will be
345335
merged.
346336
347-
You can't call this function with the same ``<executable>`` and ``<test_name>``
348-
multiple times to add more args.
337+
To avoid confusion (the name says ``add``), You can't call this function with
338+
the same ``<executable>`` and ``<test_name>`` multiple times to add more args.
349339
350340
.. code:: cmake
351341

0 commit comments

Comments
 (0)