Skip to content

Commit bbd5b02

Browse files
committed
Update: target compile flags with include directories
1 parent 240c8cd commit bbd5b02

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fpm/src/fpm_targets.f90

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,24 +433,34 @@ subroutine resolve_target_linking(targets, model)
433433

434434
integer :: i
435435
character(:), allocatable :: global_link_flags
436+
character(:), allocatable :: global_compile_flags
436437

437438
if (targets(1)%ptr%target_type == FPM_TARGET_ARCHIVE) then
438439
global_link_flags = targets(1)%ptr%output_file
439440
else
440441
allocate(character(0) :: global_link_flags)
441442
end if
442443

444+
global_compile_flags = model%fortran_compile_flags
445+
443446
if (allocated(model%link_libraries)) then
444447
if (size(model%link_libraries) > 0) then
445448
global_link_flags = global_link_flags // " -l" // string_cat(model%link_libraries," -l")
446449
end if
447450
end if
448451

452+
if (allocated(model%include_dirs)) then
453+
if (size(model%include_dirs) > 0) then
454+
global_compile_flags = global_compile_flags // &
455+
& " -I" // string_cat(model%include_dirs," -I")
456+
end if
457+
end if
458+
449459
do i=1,size(targets)
450460

451461
associate(target => targets(i)%ptr)
452462

453-
target%compile_flags = model%fortran_compile_flags
463+
target%compile_flags = global_compile_flags
454464

455465
allocate(target%link_objects(0))
456466

0 commit comments

Comments
 (0)