function(xtest_define_example NAME) set(TARGET_NAME "example-${NAME}") add_xtest_executable(${TARGET_NAME} source.c ${NAME}.c ${ARGN}) if (NAME STREQUAL "all") set(EXAMPLE_COMPILE_DEFINITIONS ${EXAMPLE_COMPILE_DEFINITIONS} XTEST_ALL_EXAMPLES) endif () target_compile_definitions(${TARGET_NAME} PRIVATE ${EXAMPLE_COMPILE_DEFINITIONS}) target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic) endfunction() if (XTEST_BUILD_EXAMPLES) xtest_define_example(all assertions.c expect_assertions.c fail.c float.c groups.c parameterized.c prng.c skip.c) xtest_define_example(assertions) xtest_define_example(expect_assertions) xtest_define_example(fail) xtest_define_example(float) xtest_define_example(groups) xtest_define_example(parameterized) xtest_define_example(prng) xtest_define_example(skip) endif ()