Skip to content

Commit 9c342f4

Browse files
committed
Minor fix: explicitly specify .exe suffix in windows.
1 parent 0d387fc commit 9c342f4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fpm/src/fpm_targets.f90

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ subroutine targets_from_sources(model,sources)
1313
type(srcfile_t), intent(in) :: sources(:)
1414

1515
integer :: i
16+
character(:), allocatable :: xsuffix
1617
type(build_target_t), pointer :: dep
1718
logical :: with_lib
1819

20+
if (get_os_type() == OS_WINDOWS) then
21+
xsuffix = '.exe'
22+
else
23+
xsuffix = ''
24+
end if
25+
1926
with_lib = any([(sources(i)%unit_scope == FPM_SCOPE_LIB,i=1,size(sources))])
2027

2128
if (with_lib) call add_target(model%targets,type = FPM_TARGET_ARCHIVE,&
@@ -46,11 +53,13 @@ subroutine targets_from_sources(model,sources)
4653
if (sources(i)%unit_scope == FPM_SCOPE_APP) then
4754
call add_target(model%targets,type = FPM_TARGET_EXECUTABLE,&
4855
link_libraries = sources(i)%link_libraries, &
49-
output_file = join_path(model%output_directory,'app',sources(i)%exe_name))
56+
output_file = join_path(model%output_directory,'app', &
57+
sources(i)%exe_name//xsuffix))
5058
else
5159
call add_target(model%targets,type = FPM_TARGET_EXECUTABLE,&
5260
link_libraries = sources(i)%link_libraries, &
53-
output_file = join_path(model%output_directory,'test',sources(i)%exe_name))
61+
output_file = join_path(model%output_directory,'test', &
62+
sources(i)%exe_name//xsuffix))
5463

5564
end if
5665

0 commit comments

Comments
 (0)