Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,9 @@ pushd c_header_only
"$fpm" build
popd

pushd c_main
"$fpm" run
popd

# Cleanup
rm -rf ./*/build
5 changes: 5 additions & 0 deletions example_packages/c_main/app/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int
main (void)
{
return 0;
}
5 changes: 5 additions & 0 deletions example_packages/c_main/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = "c-main"

[[executable]]
name = "c-main"
main = "main.c"
16 changes: 10 additions & 6 deletions src/fpm_sources.f90
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,23 @@ 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

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

Expand Down