From 61ec2c4f955d90cee2ff9ae66185dec16ab6b1bb Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Wed, 23 Oct 2024 15:47:59 +0200 Subject: [PATCH] Reduce boilerplate for failing build tests --- extras/tests/FailingBuilds/CMakeLists.txt | 29 +++++++++-------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/extras/tests/FailingBuilds/CMakeLists.txt b/extras/tests/FailingBuilds/CMakeLists.txt index 4c26477c..ebe15f84 100644 --- a/extras/tests/FailingBuilds/CMakeLists.txt +++ b/extras/tests/FailingBuilds/CMakeLists.txt @@ -2,7 +2,11 @@ # Copyright © 2014-2024, Benoit BLANCHON # MIT License -macro(build_should_fail target) +macro(add_failing_build source_file) + get_filename_component(target ${source_file} NAME_WE) + + add_executable(${target} ${source_file}) + set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL TRUE @@ -20,20 +24,9 @@ macro(build_should_fail target) ) endmacro() -add_executable(Issue978 Issue978.cpp) -build_should_fail(Issue978) - -add_executable(read_long_long read_long_long.cpp) -build_should_fail(read_long_long) - -add_executable(write_long_long write_long_long.cpp) -build_should_fail(write_long_long) - -add_executable(variant_as_char variant_as_char.cpp) -build_should_fail(variant_as_char) - -add_executable(assign_char assign_char.cpp) -build_should_fail(assign_char) - -add_executable(deserialize_object deserialize_object.cpp) -build_should_fail(deserialize_object) +add_failing_build(Issue978.cpp) +add_failing_build(read_long_long.cpp) +add_failing_build(write_long_long.cpp) +add_failing_build(variant_as_char.cpp) +add_failing_build(assign_char.cpp) +add_failing_build(deserialize_object.cpp)