# A sample cmake/fpm project template for Fortran apps

**URL:** <https://fortran-lang.discourse.group/t/a-sample-cmake-fpm-project-template-for-fortran-apps/9953>\
**Category:** Announcements\
**Created:** [July 28, 2025, 11:44am UTC](https://fortran-lang.discourse.group/t/a-sample-cmake-fpm-project-template-for-fortran-apps/9953 "2025-07-28T11:44:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgeg](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jorgeg/32/6835_2.png) [@jorgeg](https://fortran-lang.discourse.group/u/jorgeg)\
**Post date:** [July 28, 2025, 11:44am UTC](https://fortran-lang.discourse.group/t/a-sample-cmake-fpm-project-template-for-fortran-apps/9953/1 "2025-07-28T11:44:08Z")

</div>

In a similar spirit to [Fortran project template generator (CMake, Meson, Fpm)](https://fortran-lang.discourse.group/t/fortran-project-template-generator-cmake-meson-fpm/8839) 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](https://github.com/JorgeG94/modern-fortran-project)

This template provides a stable CMakeLists.txt which will automatically load [test-drive](https://github.com/fortran-lang/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](https://github.com/gha3mi/setup-fortran-conda/tree/main) 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 🙂
