I might be wrong but I don’t think there is such an option in FPM yet. The workaround that I can think of is to create four github repositories, for example,
fortuno-infrastructure,fortuno-MPI,fortuno-coarray,fortuno-serial.
The first repo contains shared contents and the rest three contain library specific contents and their own fpm.toml. Then FPM users could add corresponding dependency as needed. For example, if the coarray version is used, the following could be added to the user’s fpm.toml
[dependencies]
fortuno-coarray.git = "https://github.com/fortuno-repos/fortuno-coarray"
This is not elegant at all and I guess CMake or meson are still the best choices if you need sophisticated compilation options. For example, Meson does have an explicit coarray dependency.