FILE(GLOB TestList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) FOREACH( TestName1 ${TestList} ) STRING(REPLACE ".cpp" "" TestName ${TestName1}) add_executable( ${TestName} ${CMAKE_CURRENT_SOURCE_DIR}/${TestName}.cpp ) ENDFOREACH( TestName1 ${TestList} )