Skip to content

Commit 1440469

Browse files
committed
Merge branch 'refactor-sources' into refactor-run-cmd
2 parents 7701274 + 4071e13 commit 1440469

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

fpm/src/fpm_backend.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ subroutine build_package(model)
3333
end if
3434

3535
if (model%targets(1)%ptr%target_type == FPM_TARGET_ARCHIVE) then
36-
linking = ' -l'//model%package_name//" -L"//&
37-
join_path(model%output_directory,model%package_name)
36+
linking = " "//model%targets(1)%ptr%output_file
3837
else
3938
linking = " "
4039
end if

fpm/src/fpm_targets.f90

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,32 @@ subroutine add_target(targets,type,output_file,source)
114114
character(*), intent(in) :: output_file
115115
type(srcfile_t), intent(in), optional :: source
116116

117+
integer :: i
117118
type(build_target_ptr), allocatable :: temp(:)
118119
type(build_target_t), pointer :: new_target
119120

121+
if (.not.allocated(targets)) allocate(targets(0))
122+
123+
! Check for duplicate outputs
124+
do i=1,size(targets)
125+
126+
if (targets(i)%ptr%output_file == output_file) then
127+
128+
write(*,*) 'Error while building target list: duplicate output object "',&
129+
output_file,'"'
130+
if (present(source)) write(*,*) ' Source file: "',source%file_name,'"'
131+
stop 1
132+
133+
end if
134+
135+
end do
136+
120137
allocate(new_target)
121138
new_target%target_type = type
122139
new_target%output_file = output_file
123140
if (present(source)) new_target%source = source
124141
allocate(new_target%dependencies(0))
125-
126-
if (.not.allocated(targets)) allocate(targets(0))
142+
127143
targets = [targets, build_target_ptr(new_target)]
128144

129145
end subroutine add_target

0 commit comments

Comments
 (0)