@@ -51,13 +51,14 @@ function parse_source(source_file_path,error) result(source)
51
51
end function parse_source
52
52
53
53
54
- subroutine add_sources_from_dir (sources ,directory ,scope ,with_executables ,error )
54
+ subroutine add_sources_from_dir (sources ,directory ,scope ,with_executables ,recurse , error )
55
55
! Enumerate sources in a directory
56
56
!
57
57
type (srcfile_t), allocatable , intent (inout ), target :: sources(:)
58
58
character (* ), intent (in ) :: directory
59
59
integer , intent (in ) :: scope
60
60
logical , intent (in ), optional :: with_executables
61
+ logical , intent (in ), optional :: recurse
61
62
type (error_t), allocatable , intent (out ) :: error
62
63
63
64
integer :: i
@@ -68,7 +69,7 @@ subroutine add_sources_from_dir(sources,directory,scope,with_executables,error)
68
69
type (srcfile_t), allocatable :: dir_sources(:)
69
70
70
71
! Scan directory for sources
71
- call list_files(directory, file_names,recurse= .true. )
72
+ call list_files(directory, file_names,recurse= merge (recurse, .true. , present (recurse)) )
72
73
73
74
if (allocated (sources)) then
74
75
allocate (existing_src_files(size (sources)))
@@ -135,8 +136,8 @@ subroutine add_executable_sources(sources,executables,scope,auto_discover,error)
135
136
call get_executable_source_dirs(exe_dirs,executables)
136
137
137
138
do i= 1 ,size (exe_dirs)
138
- call add_sources_from_dir(sources,exe_dirs(i)% s, &
139
- scope, with_executables= auto_discover,error= error)
139
+ call add_sources_from_dir(sources,exe_dirs(i)% s, scope, &
140
+ with_executables= auto_discover, recurse = .false. , error= error)
140
141
141
142
if (allocated (error)) then
142
143
return
0 commit comments