fortran-lang / fpm

Fortran Package Manager (fpm)
https://fpm.fortran-lang.org
MIT License
844 stars 95 forks source link

App is not installed if source is not main.f90 #1033

Closed aradi closed 1 month ago

aradi commented 1 month ago

Description

I have created a generic cookiecutter template for Fortran projects offering various modern build systems as option, among others also fpm. When trying to get the same repository layout for all build systems, which differs slightly from fpm's default layout, I stumbled about a strange behavior upon app installation:

fpm new test
cd test
mv app/main.f90 app/myapp.f90
fpm build
fpm install --prefix $PWD/_install

Expected Behaviour

The code above should install the program myapp into _install/bin

Version of fpm

0.10.1

Platform and Architecture

Linux

Additional Information

My current workaround is to specify name and main for myapp in the [[executable]] section, but in my opinion, it should work without it out of the box.

perazz commented 1 month ago

Thank you for reporting this @aradi. You're stumbling upon the fact that the default auto-executables option, really has always been searching for a main.f90 rather than "any program definitions", like is reported in the documentation:

https://github.com/fortran-lang/fpm/blob/88ebb0adec1566b324616f5adcd13a51359245a0/src/fpm/manifest.f90#L45-L58

EDIT: fpm run builds and runs it just fine, so yes, there is a bug in fpm install