diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2021-04-08 15:40:33 +0100 |
---|---|---|
committer | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-04-09 14:45:29 +0100 |
commit | f85a458f7ab35ee53ab188b3679e05fae5e5819c (patch) | |
tree | a6a0adc281a9854188611c2658a0b98aec3bc98b | |
parent | c957b27d275ebd575b5d49599c14e7252765f3ce (diff) | |
download | fpm-f85a458f7ab35ee53ab188b3679e05fae5e5819c.tar.gz fpm-f85a458f7ab35ee53ab188b3679e05fae5e5819c.zip |
Fix include flags for c objects
-rw-r--r-- | src/fpm_backend.f90 | 2 | ||||
-rw-r--r-- | src/fpm_targets.f90 | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/fpm_backend.f90 b/src/fpm_backend.f90 index be4c4c9..8c4cf40 100644 --- a/src/fpm_backend.f90 +++ b/src/fpm_backend.f90 @@ -242,7 +242,7 @@ subroutine build_target(model,target) // " -o " // target%output_file) case (FPM_TARGET_C_OBJECT) - call run(model%c_compiler//" -c " // target%source%file_name & + call run(model%c_compiler//" -c " // target%source%file_name // target%compile_flags & // " -o " // target%output_file) case (FPM_TARGET_EXECUTABLE) diff --git a/src/fpm_targets.f90 b/src/fpm_targets.f90 index 6d4d8f0..7a06877 100644 --- a/src/fpm_targets.f90 +++ b/src/fpm_targets.f90 @@ -445,7 +445,7 @@ subroutine resolve_target_linking(targets, model) integer :: i character(:), allocatable :: global_link_flags - character(:), allocatable :: global_compile_flags + character(:), allocatable :: global_include_flags if (size(targets) == 0) return @@ -455,17 +455,16 @@ 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 + allocate(character(0) :: global_include_flags) if (allocated(model%include_dirs)) then if (size(model%include_dirs) > 0) then - global_compile_flags = global_compile_flags // & + global_include_flags = global_include_flags // & & " -I" // string_cat(model%include_dirs," -I") end if end if @@ -474,7 +473,11 @@ subroutine resolve_target_linking(targets, model) associate(target => targets(i)%ptr) - target%compile_flags = global_compile_flags + if (target%target_type /= FPM_TARGET_C_OBJECT) then + target%compile_flags = model%fortran_compile_flags//" "//global_include_flags + else + target%compile_flags = global_include_flags + end if allocate(target%link_objects(0)) |