file(GLOB TEST_SOURCES test_*.cpp) foreach(TEST_SOURCE ${TEST_SOURCES}) get_filename_component(TEST_SOURCE_NAME ${TEST_SOURCE} NAME_WE) add_executable(${TEST_SOURCE_NAME} ${TEST_SOURCE}) add_test(${TEST_SOURCE_NAME} ${TEST_SOURCE_NAME}) endforeach()