From 64ce7b9da5826b3b728d470ae11994c23e234440 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Mon, 10 Jan 2022 08:13:42 +0100 Subject: Respect user provided main-files (#646) - add example package for C-main --- src/fpm_sources.f90 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/fpm_sources.f90') diff --git a/src/fpm_sources.f90 b/src/fpm_sources.f90 index f349a0e..af2870f 100644 --- a/src/fpm_sources.f90 +++ b/src/fpm_sources.f90 @@ -163,6 +163,7 @@ subroutine add_executable_sources(sources,executables,scope,auto_discover,error) if (allocated(executables(i)%link)) then sources(j)%link_libraries = executables(i)%link end if + sources(j)%unit_type = FPM_UNIT_PROGRAM cycle exe_loop end if @@ -170,12 +171,15 @@ subroutine add_executable_sources(sources,executables,scope,auto_discover,error) end do ! Add if not already discovered (auto_discovery off) - exe_source = parse_source(join_path(executables(i)%source_dir,executables(i)%main),error) - exe_source%exe_name = executables(i)%name - if (allocated(executables(i)%link)) then - exe_source%link_libraries = executables(i)%link - end if - exe_source%unit_scope = scope + associate(exe => executables(i)) + exe_source = parse_source(join_path(exe%source_dir,exe%main),error) + exe_source%exe_name = exe%name + if (allocated(exe%link)) then + exe_source%link_libraries = exe%link + end if + exe_source%unit_type = FPM_UNIT_PROGRAM + exe_source%unit_scope = scope + end associate if (allocated(error)) return -- cgit v1.2.3