Open urbanjost opened 2 years ago
This could be an issue with how we handle the default executable, test and example target. In case of automatic detection we actually don't have to create those targets in the manifest because they will be found later, this might be something that is controlled completely by the setup of the manifest data types.
The build table is parsed before we parse the executables and the defaults are applied even later.
Description
auto-build of files in the app/ directory only occurs if the file main.f90 exists. Even the case where main.f90 is renamed to main.F90 is not built.
This is true in general. If I have only the file app/myprogram.f90 in app/ it is not built automatically, but if I leave the trivial app/main.f90 file generated by
fpm new
and add the file app/myprogram.f90 both programs are built just usingbuild fpm
.Expected Behaviour
I expect that with auto-build on any programs in the app/ directory would be built, and that it would not require app/main.f90 to be present; as the src/ directory does not require src/main.f90 to be present for an auto-build to work.
If the file is explicitly added to the fpm.toml file it is built, but I do not expect that to be required.
Also, somewhat confusingly, if I have app/main.f90 and app/main.F90 in the above I get "main" and "bug" built; I might expect an error to occur indicating there is a duplicate and for main.F90 to also be building an executable called "bug" but that is maybe more arguable.
Version of fpm
0.4.0
Platform and Architecture
All
Additional Information
Also, reserving the name "main.f90" is perhaps OK, but it seems more natural for the
new
subcommand to create a file called "package_name".f90 instead of "main.f90"; but that does not get built either unless this behavior (requiring main.f90 to exist to auto-build). Looks like instead of testing for main.f90 testing if there are contents in the app/ directory would correct at least part of this (not seeing if filenames are the same ignoring suffixes would need another change though, I think).