diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2020-12-10 17:44:40 +0100 |
---|---|---|
committer | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2020-12-10 18:14:27 +0100 |
commit | 96c6cb0427dd794cac027f45f2e8cc131a7f905b (patch) | |
tree | 4e4a546c0152a23a00a36d3ea253ec6b49c4e286 | |
parent | 25a15af0c02ab865047a264d45fd81d6ab50718c (diff) | |
download | fpm-96c6cb0427dd794cac027f45f2e8cc131a7f905b.tar.gz fpm-96c6cb0427dd794cac027f45f2e8cc131a7f905b.zip |
Check for duplicates between executable and example targets
-rw-r--r-- | fpm/src/fpm/manifest/package.f90 | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/fpm/src/fpm/manifest/package.f90 b/fpm/src/fpm/manifest/package.f90 index 2faf328..9c759a5 100644 --- a/fpm/src/fpm/manifest/package.f90 +++ b/fpm/src/fpm/manifest/package.f90 @@ -45,6 +45,12 @@ module fpm_manifest_package public :: package_config_t, new_package + interface unique_programs + module procedure :: unique_programs1 + module procedure :: unique_programs2 + end interface unique_programs + + !> Package meta data type :: package_config_t @@ -193,6 +199,14 @@ contains if (allocated(error)) exit end do if (allocated(error)) return + + call unique_programs(self%example, error) + if (allocated(error)) return + + if (allocated(self%executable)) then + call unique_programs(self%executable, self%example, error) + if (allocated(error)) return + end if end if call get_value(table, "test", children, requested=.false.) @@ -350,7 +364,7 @@ contains !> Check whether or not the names in a set of executables are unique - subroutine unique_programs(executable, error) + subroutine unique_programs1(executable, error) !> Array of executables class(executable_config_t), intent(in) :: executable(:) @@ -372,7 +386,36 @@ contains end do if (allocated(error)) return - end subroutine unique_programs + end subroutine unique_programs1 + + + !> Check whether or not the names in a set of executables are unique + subroutine unique_programs2(executable_i, executable_j, error) + + !> Array of executables + class(executable_config_t), intent(in) :: executable_i(:) + + !> Array of executables + class(executable_config_t), intent(in) :: executable_j(:) + + !> Error handling + type(error_t), allocatable, intent(out) :: error + + integer :: i, j + + do i = 1, size(executable_i) + do j = 1, size(executable_j) + if (executable_i(i)%name == executable_j(j)%name) then + call fatal_error(error, "The program named '"//& + executable_j(j)%name//"' is duplicated. "//& + "Unique program names are required.") + exit + end if + end do + end do + if (allocated(error)) return + + end subroutine unique_programs2 end module fpm_manifest_package |