INCLUDE(${CMAKE_SOURCE_DIR}/cmake/helpers.cmake)

FILE(GLOB_RECURSE POSE_TESTS ${CMAKE_SOURCE_DIR}/examples/*.example.cpp)

foreach(EXAMPLE_FULL_PATH ${POSE_TESTS})
    GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE_FULL_PATH} NAME_WE)
    SET(EXAMPLE_TAR example.${EXAMPLE_NAME})

    MESSAGE(STATUS ">>> To build [EXAMPLE]: ${EXAMPLE_FULL_PATH} --> ${EXAMPLE_TAR}")

    ADD_EXECUTABLE(${EXAMPLE_TAR} ${EXAMPLE_FULL_PATH})
    TARGET_LINK_LIBRARIES(${EXAMPLE_TAR} helpers hyperpose gflags)
    ADD_GLOBAL_DEPS(${EXAMPLE_TAR})
endforeach()
