aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2021-04-17 12:27:09 +0100
committerLKedward <laurence.kedward@bristol.ac.uk>2021-04-17 12:29:28 +0100
commit7a8f33721974cb66d44834229aff6dd4e2031eda (patch)
treeb674eaa49a49011f162a714df322b1c0ffa192f2
parentc58584e725b904d74743c6eb2b07e372fc539b39 (diff)
downloadfpm-7a8f33721974cb66d44834229aff6dd4e2031eda.tar.gz
fpm-7a8f33721974cb66d44834229aff6dd4e2031eda.zip
Use response files on Windows but with unix_path
-rw-r--r--src/fpm_backend.f9020
1 files changed, 14 insertions, 6 deletions
diff --git a/src/fpm_backend.f90 b/src/fpm_backend.f90
index 4b19e25..21e7983 100644
--- a/src/fpm_backend.f90
+++ b/src/fpm_backend.f90
@@ -27,13 +27,13 @@
!>
module fpm_backend
-use fpm_environment, only: run
-use fpm_filesystem, only: dirname, join_path, exists, mkdir
+use fpm_environment, only: run, get_os_type, OS_WINDOWS
+use fpm_filesystem, only: dirname, join_path, exists, mkdir, unix_path
use fpm_model, only: fpm_model_t
use fpm_targets, only: build_target_t, build_target_ptr, &
FPM_TARGET_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
-use fpm_strings, only: string_t
+use fpm_strings, only: string_cat, string_t
implicit none
@@ -247,8 +247,16 @@ subroutine build_target(model,target)
//" "//target%link_flags// " -o " // target%output_file)
case (FPM_TARGET_ARCHIVE)
- call write_response_file(target%output_file//".resp" ,target%link_objects)
- call run("ar -rs " // target%output_file // " @" // target%output_file//".resp")
+
+ select case (get_os_type())
+ case (OS_WINDOWS)
+ call write_response_file(target%output_file//".resp" ,target%link_objects)
+ call run("ar -rs " // target%output_file // " @" // target%output_file//".resp")
+
+ case default
+ call run("ar -rs " // target%output_file // " " // string_cat(target%link_objects," "))
+
+ end select
end select
@@ -270,7 +278,7 @@ subroutine write_response_file(name, argv)
integer :: iarg, io
open(file=name, newunit=io)
do iarg = 1, size(argv)
- write(io, '(a)') argv(iarg)%s
+ write(io, '(a)') unix_path(argv(iarg)%s)
end do
close(io)
end subroutine write_response_file