aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpm/src/fpm_targets.f9012
1 files changed, 11 insertions, 1 deletions
diff --git a/fpm/src/fpm_targets.f90 b/fpm/src/fpm_targets.f90
index 68cfc97..b6c2e57 100644
--- a/fpm/src/fpm_targets.f90
+++ b/fpm/src/fpm_targets.f90
@@ -433,6 +433,7 @@ subroutine resolve_target_linking(targets, model)
integer :: i
character(:), allocatable :: global_link_flags
+ character(:), allocatable :: global_compile_flags
if (targets(1)%ptr%target_type == FPM_TARGET_ARCHIVE) then
global_link_flags = targets(1)%ptr%output_file
@@ -440,17 +441,26 @@ subroutine resolve_target_linking(targets, model)
allocate(character(0) :: global_link_flags)
end if
+ global_compile_flags = model%fortran_compile_flags
+
if (allocated(model%link_libraries)) then
if (size(model%link_libraries) > 0) then
global_link_flags = global_link_flags // " -l" // string_cat(model%link_libraries," -l")
end if
end if
+ if (allocated(model%include_dirs)) then
+ if (size(model%include_dirs) > 0) then
+ global_compile_flags = global_compile_flags // &
+ & " -I" // string_cat(model%include_dirs," -I")
+ end if
+ end if
+
do i=1,size(targets)
associate(target => targets(i)%ptr)
- target%compile_flags = model%fortran_compile_flags
+ target%compile_flags = global_compile_flags
allocate(target%link_objects(0))