cmake_fortran_template icon indicating copy to clipboard operation
cmake_fortran_template copied to clipboard

Update to Modern CMake style

Open SethMMorton opened this issue 5 years ago • 6 comments

The CMake style in this template is not the preferred style anymore. The CMake folks are advocating for "Modern CMake" (https://cliutils.gitlab.io/modern-cmake/, https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1), which from my understanding attempts to define everything in terms of targets and is less procedural.

I do not like providing examples to users that are using an obsolete style or do not use the best the language has to offer. I would like this template to be updated to use a more modern CMake style.

Unfortunately, I no longer use CMake (or Fortan for that matter) so I am not in a position to be updating the code to conform to best-practices. I am hoping some altruistic soul will stumble upon this issue and then create a Pull Request to make this template more modern.

SethMMorton avatar May 19 '19 23:05 SethMMorton

If you'd be interested, you could transfer ownership of this project to me. Alternatively, you could add me as a maintainer. If you don't want to be actively involved in this going forward, then I am happy to take it over from you.

emanspeaks avatar Aug 23 '19 03:08 emanspeaks

I'll give this a thought. Thanks for the offer.

SethMMorton avatar Aug 23 '19 04:08 SethMMorton

@emanspeaks It's been so long since you opened that PR, and realistically I am no longer in the Fortran or CMake game, so I don't want any lag on my part to delay further progress. I'm going to add you as a collaborator to this project so that you can contribute unhindered by me.

SethMMorton avatar May 26 '20 04:05 SethMMorton

Awesome, thanks! And no worries, you haven't been the hangup on this, I had to shelve my Fortran project at work I was originally developing the PR alongside, but in the coming weeks I will likely be picking it up again and can try to push through the final work to get that PR merged. This is an important project, so I will do my best to keep going!

emanspeaks avatar May 26 '20 04:05 emanspeaks

@emanspeaks Some time ago, I also created a cmake fortran template, that has a running unit test suite and handles the modules file via the custom function add_fortran_library() instead of putting all of them into the same directory. Feel free to copy what you want. I see too many Fortran projects with bad Cmake builds...

Leonard-Reuter avatar Oct 06 '20 11:10 Leonard-Reuter

Here is a small demo to build multiple modules with latest CMake (v 3.5+) for Fortran 2008 https://github.com/aqeelahmed168/oneDimHeatTransfer_cmake_demo

aqeelahmed168 avatar Oct 07 '20 14:10 aqeelahmed168