[cmake-developers] Fortran detection, issue 9220
Ben Boeckel
ben.boeckel at kitware.com
Wed Feb 11 09:26:51 EST 2015
On Tue, Feb 10, 2015 at 21:48:39 -0800, Alan W. Irwin wrote:
> Sorry, but I still think the general Ninja problems with Fortran are
> orthogonal to this general language support issue. Or are you
> implying that enable_language(OPTIONAL) works for Ninja now for all
> languages other than Fortran?
No, I didn't have OPTIONAL at all. All the branch does is move the error
case from "I need/want Fortran" to "I'm building this Fortran source
file".
> I frankly don't understand this comment at all. I am sure you would
> agree with me that CMake has complete knowledge of how to build
> applications and libraries with a wide variety of compilers. So I
> probably just completely missed your point.
CMake doesn't have any support for getting proper dependencies from Ada
for example. So while you could use add_custom_command to *build* Ada
files, build-time dependency scanning for things like #include or import
without a reconfigure aren't supported. Supporting a language is more
than just providing rules to build files of that type.
> Agreed. It's probably an extremely tedious task to go through all the
> code paths (including all generators and all compiled languages) for
> modern CMake language support that are executed by the
> enable_language(... OPTIONAL) command, and change all potential CMake
> error exits to warnings for that case. And I don't have the C++ skill
> or knowledge of CMake internals to help out with this tedious task
> myself. So I completely understand why a fix for bug 9220 has still not been
> accomplished after all these years. But it sure is a "would be nice".
A sketch for anyone interested (probably still not complete, but it's
things to look for):
- change cmGlobalGenerator::EnableLanguage to return a bool;
- add CMAKE_<LANG>_FOUND variables to indicate support for a language
is available;
- trigger an error when build rules for an unsupported language are
encountered.
The patch I referenced basically does the last bit for Ninja+Fortran.
--Ben
More information about the cmake-developers
mailing list