[CMake] Checking for a Fortran compiler

Radu Serban udar.nabres at gmail.com
Sun May 11 22:35:13 EDT 2008


Is there any way to check if a working Fortran compiler exists without
triggering an error if one cannot be found? My project only requires C and a
Fortran compiler is not required (not having one would simply disable some
modules but should not stop the build).

Simply including ENABLE_LANGUAGE(Fortran) doesn't work the way I need it,
since it throws an error if a Fortran compiler is not found.  So I tried
next to create a CMakeLists.txt on the fly and run TRY_COMPILE from my main
CMakeLists.txt, assuming that an error (due to a non-existent Fortran
compiler) in the CMakeLists.txt file that I create would be intercepted in
the result variable of TRY_COMPILE. No luck, it seems that the error is
propagated all the way up. Is that the way TRY_COMPILE is intended to work?

Any thoughts on what to try next?

Thanks,
--Radu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080511/b1efd852/attachment-0001.htm>


More information about the CMake mailing list