aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2020-11-23 17:55:07 +0000
committerLKedward <laurence.kedward@bristol.ac.uk>2020-11-23 17:55:07 +0000
commit71c7b9422a4da58ad92f72f00e83ec91e76e0cd0 (patch)
treee89c2dca9d20fc557c3cad3101c5471fefb4ca73
parent0a5440e413cd55ba72e200178a72c5544b618a31 (diff)
downloadfpm-71c7b9422a4da58ad92f72f00e83ec91e76e0cd0.tar.gz
fpm-71c7b9422a4da58ad92f72f00e83ec91e76e0cd0.zip
Minor fix: for link flag concatenation
-rw-r--r--fpm/src/fpm_backend.f9013
-rw-r--r--fpm/src/fpm_strings.f905
2 files changed, 12 insertions, 6 deletions
diff --git a/fpm/src/fpm_backend.f90 b/fpm/src/fpm_backend.f90
index 9e45c86..ab8a27c 100644
--- a/fpm/src/fpm_backend.f90
+++ b/fpm/src/fpm_backend.f90
@@ -209,10 +209,13 @@ subroutine build_target(model,target)
// " -o " // target%output_file)
case (FPM_TARGET_EXECUTABLE)
+
+ link_flags = string_cat(target%link_objects," ")
+
if (allocated(model%library_file)) then
- link_flags = " "//model%library_file//" "//model%link_flags
+ link_flags = link_flags//" "//model%library_file//" "//model%link_flags
else
- link_flags = " "//model%link_flags
+ link_flags = link_flags//" "//model%link_flags
end if
if (allocated(target%link_libraries)) then
@@ -220,9 +223,9 @@ subroutine build_target(model,target)
link_flags = link_flags // " -l" // string_cat(target%link_libraries," -l")
end if
end if
-
- call run("gfortran " // string_cat(target%link_objects," ") // model%fortran_compile_flags &
- //link_flags// " -o " // target%output_file)
+
+ call run("gfortran " // model%fortran_compile_flags &
+ //" "//link_flags// " -o " // target%output_file)
case (FPM_TARGET_ARCHIVE)
call run("ar -rs " // target%output_file // " " // string_cat(target%link_objects," "))
diff --git a/fpm/src/fpm_strings.f90 b/fpm/src/fpm_strings.f90
index 2d1cb72..6935215 100644
--- a/fpm/src/fpm_strings.f90
+++ b/fpm/src/fpm_strings.f90
@@ -150,7 +150,10 @@ function string_cat(strings,delim) result(cat)
integer :: i,n
character(:), allocatable :: delim_str
- if (size(strings) < 1) return
+ if (size(strings) < 1) then
+ cat = ''
+ return
+ end if
if (present(delim)) then
delim_str = delim