FPM: Platform-specific instructions to linker on fpm.toml

I cant guarantee that the following is correct, but it might be worth considering.
To add platform-specific instructions to your fpm.toml file for successful builds on Windows without affecting builds on other operating systems, you can utilize conditional compilation supported by Fortran Package Manager (fpm). This approach allows you to specify different settings for different platforms.

In fpm, conditional settings can be specified using profile sections in the fpm.toml file. Each profile can include conditions based on the operating system, compiler, or build mode, which allows you to tailor the build process for different environments.

Here’s how you can modify your fpm.toml file to include Windows-specific linker instructions:

toml

[build]
auto-executables = true
auto-tests = true
auto-examples = true
module-naming = false

# Default linker settings for non-Windows platforms
link = []

# Windows-specific settings
[profiles.windows-x86_64]
link = ["iphlpapi", "ws2_32"]

In this example, the [profiles.windows-x86_64] section is used to specify settings that should only apply when building on a 64-bit Windows platform. The link = ["iphlpapi", "ws2_32"] line within this section adds the iphlpapi and ws2_32 libraries to the linker settings, but only for Windows builds. The default link = [] in the [build] section ensures that no additional libraries are linked for non-Windows platforms.

This approach should help you avoid linker errors on other operating systems while still including the necessary libraries for Windows builds. Remember to adjust the profile name and conditions according to your specific needs and the platforms you are targeting.