Include an fpm based library within a pre-existing/mixed language CMake project

I haven’t tried this, but I’ve been thinking about doing this as well. For just a single fpm project it should be possible to:

  1. Use FetchContent to download the source
  2. Create a custom target that runs fpm and build that project
  3. Create an imported library that points at the static library that fpm built

This should work fine for a single dependency, but might get problematic for multiple projects: Say that you want to depend on fpm project lib_a and fpm project lib_b and both lib_a and lib_b depend on another fpm project lib_c. If you add both with the procedure that I outlined above then fpm will build lib_c once for both lib_a and lib_b. This will most likely lead to problems with the fact that you now have duplicate versions of lib_c’s .mod files and its compiled functions.