function(addTestMacro)
    if(BUILD_TESTS)
        FILE(GLOB TEST_SOURCES "tests/*.c*")
        FILE(GLOB TEST_HEADERS "tests/*.h")

        SOURCE_GROUP("Unit-Tests" FILES ${TEST_SOURCES} ${TEST_HEADERS})
        FOREACH(testFile ${TEST_SOURCES})
            STRING(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/tests/" "" testName ${testFile})
            STRING(REPLACE ".cpp" "" testName ${testName})
            add_executable(${testName} ${testFile} ${TEST_HEADERS})
            TARGET_LINK_LIBRARIES(${testName} ${LIBS})
            add_test(${testName} "${EXECUTABLE_OUTPUT_PATH}/${testName}")
            MESSAGE("found unit-test: ${testName}")
        ENDFOREACH(testFile)
    endif(BUILD_TESTS)
endfunction()