diff --git a/src/fpm.f90 b/src/fpm.f90 index ae8a07d681..29dbfa257c 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -511,7 +511,7 @@ subroutine cmd_run(settings,test) ! Enumerate executable targets to run col_width = -1 found(:) = .false. - allocate(executables(0)) + allocate(executables(size(settings%name))) do i=1,size(targets) exe_target => targets(i)%ptr @@ -534,11 +534,12 @@ subroutine cmd_run(settings,test) do j=1,size(settings%name) - if (glob(trim(exe_source%exe_name),trim(settings%name(j)))) then + if (glob(trim(exe_source%exe_name),trim(settings%name(j))) .and. .not.found(j)) then + found(j) = .true. exe_cmd%s = exe_target%output_file - executables = [executables, exe_cmd] + executables(j) = exe_cmd end if