file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/check")

macro(CHECK_TEST test_name)
    set(options OPTIONAL)
    set(oneValueArgs NAME)
    set(multiValueArgs LIBS SRC DEPS)
    cmake_parse_arguments(CHECK_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
        
    add_executable(${test_name} ${CHECK_TEST_SRC})
    target_link_libraries(${test_name} ${CHECK_LIBRARIES} ${CHECK_TEST_LIBS})
    target_include_directories(${test_name} PUBLIC ${CHECK_INCLUDE_DIR})
    add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}> WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
    if (DEFINED CHECK_TEST_DEPS)
        add_dependencies(${test_name} ${CHECK_TEST_DEPS})
    endif()
endmacro()
