Skip to content

Commit 7a8f337

Browse files
committed
Use response files on Windows but with unix_path
1 parent c58584e commit 7a8f337

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/fpm_backend.f90

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
!>
2828
module fpm_backend
2929

30-
use fpm_environment, only: run
31-
use fpm_filesystem, only: dirname, join_path, exists, mkdir
30+
use fpm_environment, only: run, get_os_type, OS_WINDOWS
31+
use fpm_filesystem, only: dirname, join_path, exists, mkdir, unix_path
3232
use fpm_model, only: fpm_model_t
3333
use fpm_targets, only: build_target_t, build_target_ptr, &
3434
FPM_TARGET_OBJECT, FPM_TARGET_ARCHIVE, FPM_TARGET_EXECUTABLE
3535

36-
use fpm_strings, only: string_t
36+
use fpm_strings, only: string_cat, string_t
3737

3838
implicit none
3939

@@ -247,8 +247,16 @@ subroutine build_target(model,target)
247247
//" "//target%link_flags// " -o " // target%output_file)
248248

249249
case (FPM_TARGET_ARCHIVE)
250-
call write_response_file(target%output_file//".resp" ,target%link_objects)
251-
call run("ar -rs " // target%output_file // " @" // target%output_file//".resp")
250+
251+
select case (get_os_type())
252+
case (OS_WINDOWS)
253+
call write_response_file(target%output_file//".resp" ,target%link_objects)
254+
call run("ar -rs " // target%output_file // " @" // target%output_file//".resp")
255+
256+
case default
257+
call run("ar -rs " // target%output_file // " " // string_cat(target%link_objects," "))
258+
259+
end select
252260

253261
end select
254262

@@ -270,7 +278,7 @@ subroutine write_response_file(name, argv)
270278
integer :: iarg, io
271279
open(file=name, newunit=io)
272280
do iarg = 1, size(argv)
273-
write(io, '(a)') argv(iarg)%s
281+
write(io, '(a)') unix_path(argv(iarg)%s)
274282
end do
275283
close(io)
276284
end subroutine write_response_file

0 commit comments

Comments
 (0)