File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 22# with full pathname. RELATIVE may makes it easier to extract an executable name
33# automatically.
44file ( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )
5- # file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6- # AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
5+
6+
77foreach ( testsourcefile ${APP_SOURCES} )
8- # I used a simple string replace, to cut off .cpp.
8+ # remove cpp from filename
99 string ( REPLACE ".cpp" "" testname ${testsourcefile} )
1010 add_executable ( ${testname} ${testsourcefile} )
1111
1212 set_target_properties (${testname} PROPERTIES LINKER_LANGUAGE CXX)
13+
14+ # add test with the same name as file name
15+ add_test (NAME ${testname} COMMAND ${testname} )
16+
1317 if (OpenMP_CXX_FOUND)
1418 target_link_libraries (${testname} OpenMP::OpenMP_CXX)
1519 endif ()
You can’t perform that action at this time.
0 commit comments