A sample cmake/fpm project template for Fortran apps

In a similar spirit to Fortran project template generator (CMake, Meson, Fpm) I found myself wanting a template repo which I could just load from the “template” option on Github. Thus I created this small sample project GitHub - JorgeG94/modern-fortran-project: A template repository for modern fortran projects

This template provides a stable CMakeLists.txt which will automatically load test-drive and build it with your application via a FetchContent_Declare.

Additionally, I’ve set up all of the necessary things such that the project can be make install-d and it is findable by any other CMake project by setting PROJ_ROOT and including a find_package(proj REQUIRED) in an extraneous CMakeLists.

Additionally, the setup of the install methodology allows another user to consume the same CMake project via the same interface test-drive is consumed.

Finally, I have included a CI/CD pipeline based on setup conda plus a .pre-commit.yaml file to ensure formatting for cmake and fortran via fprettify.

Of course I have also included an FPM option to build, also ready out of the box plus instructions on how to use.

I hope that this makes it easier for people to write new projects and make them consumable to the community not only through the FPM but through a nice CMake interface. Plus also the CI/CD is already set up :slight_smile:

6 Likes