INCLUDE(GoogleTest)
FIND_PACKAGE(GTest REQUIRED)

FUNCTION(ADD_UNITTEST _test_name)
    FILE(GLOB TEST_SOURCE_FILE "${PROJECT_SOURCE_DIR}/tests/${_test_name}.cpp")

    ADD_EXECUTABLE(${_test_name} ${TEST_SOURCE_FILE})
    TARGET_LINK_LIBRARIES(${_test_name} ybtl2 ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARIES} pthread)
    TARGET_INCLUDE_DIRECTORIES(${_test_name} PRIVATE ${YBTL2_PROJECT_INCLUDE_PATH})
    TARGET_INCLUDE_DIRECTORIES(${_test_name} PUBLIC ${GTEST_INCLUDE_DIRS})

    gtest_add_tests(${_test_name} "" AUTO)
ENDFUNCTION(ADD_UNITTEST _test_name)
