@@ -110,37 +110,23 @@ subroutine build_model(model, settings, package, error)
110
110
model% packages(i)% version = package% version% s()
111
111
112
112
! > Add this dependency's manifest macros
113
- allocate ( model% packages(i)% macros( 0 ) )
113
+ call model% packages(i)% preprocess % destroy( )
114
114
115
115
if (allocated (dependency% preprocess)) then
116
116
do j = 1 , size (dependency% preprocess)
117
- if (dependency% preprocess(j)% name == " cpp" ) then
118
- if (.not. has_cpp) has_cpp = .true.
119
- if (allocated (dependency% preprocess(j)% macros)) then
120
- model% packages(i)% macros = [model% packages(i)% macros, dependency% preprocess(j)% macros]
121
- end if
122
- else
123
- write (stderr, ' (a)' ) ' Warning: Preprocessor ' // package% preprocess(i)% name // &
124
- ' is not supported; will ignore it'
125
- end if
117
+ call model% packages(i)% preprocess% add_config(dependency% preprocess(j))
126
118
end do
127
119
end if
128
120
129
121
! > Add this dependency's package-level macros
130
122
if (allocated (dep% preprocess)) then
131
123
do j = 1 , size (dep% preprocess)
132
- if (dep% preprocess(j)% name == " cpp" ) then
133
- if (.not. has_cpp) has_cpp = .true.
134
- if (allocated (dep% preprocess(j)% macros)) then
135
- model% packages(i)% macros = [model% packages(i)% macros, dep% preprocess(j)% macros]
136
- end if
137
- else
138
- write (stderr, ' (a)' ) ' Warning: Preprocessor ' // package% preprocess(i)% name // &
139
- ' is not supported; will ignore it'
140
- end if
124
+ call model% packages(i)% preprocess% add_config(dep% preprocess(j))
141
125
end do
142
126
end if
143
127
128
+ if (model% packages(i)% preprocess% is_cpp()) has_cpp = .true.
129
+
144
130
if (.not. allocated (model% packages(i)% sources)) allocate (model% packages(i)% sources(0 ))
145
131
146
132
if (allocated (dependency% library)) then
@@ -149,7 +135,7 @@ subroutine build_model(model, settings, package, error)
149
135
lib_dir = join_path(dep% proj_dir, dependency% library% source_dir)
150
136
if (is_dir(lib_dir)) then
151
137
call add_sources_from_dir(model% packages(i)% sources, lib_dir, FPM_SCOPE_LIB, &
152
- error= error)
138
+ with_f_ext = model % packages(i) % preprocess % suffixes, error= error)
153
139
if (allocated (error)) exit
154
140
end if
155
141
end if
@@ -187,7 +173,8 @@ subroutine build_model(model, settings, package, error)
187
173
! Add sources from executable directories
188
174
if (is_dir(' app' ) .and. package% build% auto_executables) then
189
175
call add_sources_from_dir(model% packages(1 )% sources,' app' , FPM_SCOPE_APP, &
190
- with_executables= .true. , error= error)
176
+ with_executables= .true. , with_f_ext= model% packages(1 )% preprocess% suffixes,&
177
+ error= error)
191
178
192
179
if (allocated (error)) then
193
180
return
@@ -196,7 +183,8 @@ subroutine build_model(model, settings, package, error)
196
183
end if
197
184
if (is_dir(' example' ) .and. package% build% auto_examples) then
198
185
call add_sources_from_dir(model% packages(1 )% sources,' example' , FPM_SCOPE_EXAMPLE, &
199
- with_executables= .true. , error= error)
186
+ with_executables= .true. , &
187
+ with_f_ext= model% packages(1 )% preprocess% suffixes,error= error)
200
188
201
189
if (allocated (error)) then
202
190
return
@@ -205,7 +193,8 @@ subroutine build_model(model, settings, package, error)
205
193
end if
206
194
if (is_dir(' test' ) .and. package% build% auto_tests) then
207
195
call add_sources_from_dir(model% packages(1 )% sources,' test' , FPM_SCOPE_TEST, &
208
- with_executables= .true. , error= error)
196
+ with_executables= .true. , &
197
+ with_f_ext= model% packages(1 )% preprocess% suffixes,error= error)
209
198
210
199
if (allocated (error)) then
211
200
return
@@ -215,6 +204,7 @@ subroutine build_model(model, settings, package, error)
215
204
if (allocated (package% executable)) then
216
205
call add_executable_sources(model% packages(1 )% sources, package% executable, FPM_SCOPE_APP, &
217
206
auto_discover= package% build% auto_executables, &
207
+ with_f_ext= model% packages(1 )% preprocess% suffixes, &
218
208
error= error)
219
209
220
210
if (allocated (error)) then
@@ -225,6 +215,7 @@ subroutine build_model(model, settings, package, error)
225
215
if (allocated (package% example)) then
226
216
call add_executable_sources(model% packages(1 )% sources, package% example, FPM_SCOPE_EXAMPLE, &
227
217
auto_discover= package% build% auto_examples, &
218
+ with_f_ext= model% packages(1 )% preprocess% suffixes, &
228
219
error= error)
229
220
230
221
if (allocated (error)) then
@@ -235,6 +226,7 @@ subroutine build_model(model, settings, package, error)
235
226
if (allocated (package% test)) then
236
227
call add_executable_sources(model% packages(1 )% sources, package% test, FPM_SCOPE_TEST, &
237
228
auto_discover= package% build% auto_tests, &
229
+ with_f_ext= model% packages(1 )% preprocess% suffixes, &
238
230
error= error)
239
231
240
232
if (allocated (error)) then
0 commit comments