find_package(Eigen3) find_package(Catch2 REQUIRED) set(BENCH_SOURCES bench.cpp bench_euler.cpp bench_mbd.cpp) foreach( benchsourcefile ${BENCH_SOURCES} ) # I used a simple string replace, to cut off .cpp. string( REPLACE ".cpp" "" benchmarkname ${benchsourcefile} ) add_executable( ${benchmarkname} ${benchsourcefile} ) # Make sure YourLib is linked to each app target_link_libraries( ${benchmarkname} PRIVATE project_options project_warnings Eigen3::Eigen3 Catch2::Catch2 integratoren ) endforeach( benchsourcefile ${BENCH_SOURCES} )