Compiler version for NAG compiler not working properly
Around version 3.9 new code was merged (!809 (merged)) that generates CMAKE_Fortran_COMPILER_VERSION
for the NAG Fortran compiler. This new code is not working properly. There are several issues:
- The most critical is that it returns
0.0.0
for NAG compiler versions earlier than 6.1 (the current version at this time). The new code relies on the macro__NAG_COMPILER_BUILD
which was introduced in 6.1, and therefore is only able to detect the version of 6.1 compilers. For all others it returns the bogus value0.0.0
instead of leaving the variable undefined like it ought to (so that things likeif(CMAKE_Fortran_COMPILER_VERSION) ...
work as expected). I think the current behavior is simply what the code produces when the macro is not defined -- no check that it is defined or not. - The current code uses the value of
__NAG_COMPILER_BUILD
for the patch value of the version string. I think this is a poor choice. I've discussed with the NAG developers about how they define this BUILD value (big "B" build). It is formed from the major and minor version numbers, and the build number of that version (little "b" build):
__NAG_COMPILER_BUILD = major * 1000 + minor * 100 + build
where they assert minor will never exceed 9, and build will never exceed 99.
I think 'build' would be much more appropriate as the patch number of the version string.
3. I have working cmake code that generates CMAKE_Fortran_COMPILER_VERSION
for NAG Fortran compiler versions earlier than 6.1. I've been using it for years. However it relies on processing the output of nagfor -version
to acquire the data. Prior to 6.1 the compiler defines no macros that can be used for this purpose. Is there some place in the internal cmake modules where something like this could go? I've poked around a bit at the module files where compiler ID and version stuff is done, but I can't make much sense of the flow. If someone could give me some pointers, I'd like to try to add it myself.