Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove specification of fortran compiler standard from CMakeLists.txt #189

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

jatkinson1000
Copy link
Member

@jatkinson1000 jatkinson1000 commented Nov 12, 2024

Potential to close #188

Removes the specification of -std=f2008 as a Fortran compiler flag in CMakeLists.

This is a gcc specific flag that raises warnings for other compilers e.g. intel.

Whilst we could implement if-else blocks for different compilers this may still cause unforeseen issues and I do not believe it is necessary - see discussions at https://gitlab.kitware.com/cmake/cmake/-/issues/25006 and https://gitlab.kitware.com/cmake/cmake/-/issues/22235

Most compilers enable the latest Fortran standards that they support by default (different to C++ and C).
We still enforce this flag during the test suite as a check that code is compliant, but it is more of a guard against the introduction of features from a new spec rather than to enable features that may otherwise be unavailable.

I think specifying that we need a Fortran compiler that supports the 2008 standard as part of the documentation is sufficient for this.

Therefore I propose removing these lines (which would be overwritten by any CMAKE_Fortran_FLAGS a user might specify anyway!!).

Also note (see above discussions) that there is no Fortran equivalent to CMAKE_CXX_STANDARD=17.

Copy link
Member

@j-emberton j-emberton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. Interesting to learn about the differences between the C languages and Fortran, and the behaviour of the intel and gnu compilers.

Copy link
Member

@TomMelt TomMelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I don't think we need this for release builds.

FWIW, for C/C++ if we wanted to set standards in a compiler agnostic way, we could use CMake's Requiring Language Standards.

However, this is not supported for Fortran (at least not presently, see here for more info).

@TomMelt TomMelt merged commit 2265ca0 into main Nov 12, 2024
6 checks passed
@TomMelt TomMelt deleted the fortran-std-cmake branch November 12, 2024 14:41
@jatkinson1000
Copy link
Member Author

@TomMelt Do you mean "not supported for Fortran" at present?

I think those are the same conversations and settings linked in my main comment...?

@TomMelt
Copy link
Member

TomMelt commented Nov 12, 2024

@TomMelt Do you mean "not supported for Fortran" at present?

I think those are the same conversations and settings linked in my main comment...?

Haha yes. I did mean Fortran and whoops.... I didn't click your links 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specification of fortran standard in CMakeLists raises a warning with intel.
3 participants