From 71c7b9422a4da58ad92f72f00e83ec91e76e0cd0 Mon Sep 17 00:00:00 2001 From: LKedward Date: Mon, 23 Nov 2020 17:55:07 +0000 Subject: Minor fix: for link flag concatenation --- fpm/src/fpm_backend.f90 | 13 ++++++++----- fpm/src/fpm_strings.f90 | 5 ++++- 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 -- cgit v1.2.3