@@ -445,7 +445,7 @@ subroutine resolve_target_linking(targets, model)
445
445
446
446
integer :: i
447
447
character (:), allocatable :: global_link_flags
448
- character (:), allocatable :: global_compile_flags
448
+ character (:), allocatable :: global_include_flags
449
449
450
450
if (size (targets) == 0 ) return
451
451
@@ -455,17 +455,16 @@ subroutine resolve_target_linking(targets, model)
455
455
allocate (character (0 ) :: global_link_flags)
456
456
end if
457
457
458
- global_compile_flags = model% fortran_compile_flags
459
-
460
458
if (allocated (model% link_libraries)) then
461
459
if (size (model% link_libraries) > 0 ) then
462
460
global_link_flags = global_link_flags // " -l" // string_cat(model% link_libraries," -l" )
463
461
end if
464
462
end if
465
463
464
+ allocate (character (0 ) :: global_include_flags)
466
465
if (allocated (model% include_dirs)) then
467
466
if (size (model% include_dirs) > 0 ) then
468
- global_compile_flags = global_compile_flags // &
467
+ global_include_flags = global_include_flags // &
469
468
& " -I" // string_cat(model% include_dirs," -I" )
470
469
end if
471
470
end if
@@ -474,7 +473,11 @@ subroutine resolve_target_linking(targets, model)
474
473
475
474
associate(target = > targets(i)% ptr)
476
475
477
- target % compile_flags = global_compile_flags
476
+ if (target % target_type /= FPM_TARGET_C_OBJECT) then
477
+ target % compile_flags = model% fortran_compile_flags// " " // global_include_flags
478
+ else
479
+ target % compile_flags = global_include_flags
480
+ end if
478
481
479
482
allocate (target % link_objects(0 ))
480
483
0 commit comments