Skip to content

Commit 61ec2c4

Browse files
committed
Reduce boilerplate for failing build tests
1 parent 0dd6231 commit 61ec2c4

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

extras/tests/FailingBuilds/CMakeLists.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
# Copyright © 2014-2024, Benoit BLANCHON
33
# MIT License
44

5-
macro(build_should_fail target)
5+
macro(add_failing_build source_file)
6+
get_filename_component(target ${source_file} NAME_WE)
7+
8+
add_executable(${target} ${source_file})
9+
610
set_target_properties(${target}
711
PROPERTIES
812
EXCLUDE_FROM_ALL TRUE
@@ -20,20 +24,9 @@ macro(build_should_fail target)
2024
)
2125
endmacro()
2226

23-
add_executable(Issue978 Issue978.cpp)
24-
build_should_fail(Issue978)
25-
26-
add_executable(read_long_long read_long_long.cpp)
27-
build_should_fail(read_long_long)
28-
29-
add_executable(write_long_long write_long_long.cpp)
30-
build_should_fail(write_long_long)
31-
32-
add_executable(variant_as_char variant_as_char.cpp)
33-
build_should_fail(variant_as_char)
34-
35-
add_executable(assign_char assign_char.cpp)
36-
build_should_fail(assign_char)
37-
38-
add_executable(deserialize_object deserialize_object.cpp)
39-
build_should_fail(deserialize_object)
27+
add_failing_build(Issue978.cpp)
28+
add_failing_build(read_long_long.cpp)
29+
add_failing_build(write_long_long.cpp)
30+
add_failing_build(variant_as_char.cpp)
31+
add_failing_build(assign_char.cpp)
32+
add_failing_build(deserialize_object.cpp)

0 commit comments

Comments
 (0)