option(BR_TEST_EXAMPLES "Test OpenBR example applications" ON) file(GLOB EXAMPLES *.cpp) foreach(EXAMPLE ${EXAMPLES}) get_filename_component(EXAMPLE_BASENAME ${EXAMPLE} NAME_WE) add_executable(${EXAMPLE_BASENAME} ${EXAMPLE}) qt5_use_modules(${EXAMPLE_BASENAME} ${QT_DEPENDENCIES}) target_link_libraries(${EXAMPLE_BASENAME} openbr ${BR_THIRDPARTY_LIBS}) install(TARGETS ${EXAMPLE_BASENAME} RUNTIME DESTINATION bin) if(BUILD_TESTING) if(${BR_TEST_EXAMPLES}) add_test(NAME ${EXAMPLE_BASENAME}_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ${EXAMPLE_BASENAME}) endif() endif() endforeach()