Support for fortran interoperability with C within CMake

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Support for fortran interoperability with C within CMake

David Vowles



As you may be aware recent Fortran standards have introduced the notion of standardised interoperability of Fortran with C. To enable practical implementation of standardised interoperability the Fortran standard has the notion of the Fortran compiler having a "companion C processor" – read compatible C compiler. Each Fortran implementation is free to choose which C is its companion or companions. The question therefore arises as to whether CMake is yet smart enough to correctly choose compatible combinations of C and Fortran compilers.


An example might be as follows.


A system has C compilers C1, C2 and C3 and Fortran compilers F1 and F2 installed. Compiler C1 is not interoperable with F1 or F2, C2 is interoperable with F1 but not F2 and C3 is interoperable with both F1 and F2. It would be highly desirable for CMake to:

(i)                Inform the user (e.g. by a fatal error) that if they choose C1 as their C compiler then there is no compatible Fortran compiler available on their system;

(ii)              If the user does not specify either a C or Fortran compiler that a compatible pair be chosen by CMake. In the example given it might be preferable (all other things being equal) for C3 to be chosen as the C compiler since it maximizes the number of Fortran compilers with which the software can be built.


Does CMake current offer any support in this area? Are there any plans to implement / extend such support?


Many thanks,




Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: