Binary/executable on a better path or user-defined subdirectory

FPM creates the binary/executable of a code in the subdirectories of the build directory, named with the compiler and eventually with the subdirectory “app”.
I search fortran-lang page and FPM tutorial, etc and I could not find a solution such that I can specify the target directory of the executable or a way of making a soft link into a preferred directory. I know that it can be done by a bash or some other way, but I would rather do this through FPM so that the last step would be “fpm build”.

I appreciate any comment!
Alireza

1 Like

You cannot do a soft link, but you can use the install command:

fpm install --prefix=/path/to/end/folder
1 Like

Thanks very much for your comment.
Actually, I have used “fpm install --prefix” for a part of my code, prior to the main part. For that smaller part, I see that everything is being copied including *.o and *.mod files. Therefore, these files are duplicated, while I am interested only in having the binary file in a proper location.
Nevertheless, I agree that “fpm install” is a nice way since the package can be used as a library for another package.

fpm should only install the executables unless you turn install.library on in the manifest:

https://fpm.fortran-lang.org/spec/manifest.html#installation-configuration

please, check that in your fpm.toml:

[install]
library = false

or that there is no such key

Thanks a lot!
The combination of
–prefix and --bindir when using “fpm install” does what I needed.

1 Like