diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2020-11-08 13:02:44 +0000 |
---|---|---|
committer | LKedward <laurence.kedward@bristol.ac.uk> | 2020-11-08 13:02:44 +0000 |
commit | 144046926629b94da1b18ad19038e4c9ec372b2a (patch) | |
tree | a053d4b3155216d374ee3be9b884c3c522ef2ce1 | |
parent | 7701274d230c479c4502d098cd421b8223fe66a5 (diff) | |
parent | 4071e13104cc9b82ddd6969183a378b5a3f27b1c (diff) | |
download | fpm-144046926629b94da1b18ad19038e4c9ec372b2a.tar.gz fpm-144046926629b94da1b18ad19038e4c9ec372b2a.zip |
Merge branch 'refactor-sources' into refactor-run-cmd
-rw-r--r-- | fpm/src/fpm_backend.f90 | 3 | ||||
-rw-r--r-- | fpm/src/fpm_targets.f90 | 20 |
2 files changed, 19 insertions, 4 deletions
diff --git a/fpm/src/fpm_backend.f90 b/fpm/src/fpm_backend.f90 index e8f51cc..f70f477 100644 --- a/fpm/src/fpm_backend.f90 +++ b/fpm/src/fpm_backend.f90 @@ -33,8 +33,7 @@ subroutine build_package(model) end if if (model%targets(1)%ptr%target_type == FPM_TARGET_ARCHIVE) then - linking = ' -l'//model%package_name//" -L"//& - join_path(model%output_directory,model%package_name) + linking = " "//model%targets(1)%ptr%output_file else linking = " " end if diff --git a/fpm/src/fpm_targets.f90 b/fpm/src/fpm_targets.f90 index 54f0764..2cd4418 100644 --- a/fpm/src/fpm_targets.f90 +++ b/fpm/src/fpm_targets.f90 @@ -114,16 +114,32 @@ subroutine add_target(targets,type,output_file,source) character(*), intent(in) :: output_file type(srcfile_t), intent(in), optional :: source + integer :: i type(build_target_ptr), allocatable :: temp(:) type(build_target_t), pointer :: new_target + if (.not.allocated(targets)) allocate(targets(0)) + + ! Check for duplicate outputs + do i=1,size(targets) + + if (targets(i)%ptr%output_file == output_file) then + + write(*,*) 'Error while building target list: duplicate output object "',& + output_file,'"' + if (present(source)) write(*,*) ' Source file: "',source%file_name,'"' + stop 1 + + end if + + end do + allocate(new_target) new_target%target_type = type new_target%output_file = output_file if (present(source)) new_target%source = source allocate(new_target%dependencies(0)) - - if (.not.allocated(targets)) allocate(targets(0)) + targets = [targets, build_target_ptr(new_target)] end subroutine add_target |