[cmake-developers] Assembly/preprocessed targets for Fortran

Tim Gallagher tim.gallagher at gatech.edu
Tue Nov 4 15:19:45 EST 2014


Hi all,

I was trying to generate the assembly listing for some Fortran code and while searching for how to do it in CMake, I came across an email thread from a few years ago from somebody asking how to do it in C/C++ by running `make <file>.s`. I vaguely remembered knowing this at one point so I tried it with my Fortran source and those targets didn't exist. I was about to get on the mailing list to ask if anybody else came across this problem, but first I clicked through the email thread and there was a message that I sent out basically saying "Hey, this doesn't work for Fortran -- is there any way that could be fixed?" 

I guess I send too many emails and forgot about that. 

At any rate, I looked through the CMake source code and it didn't seem that hard to make it work correctly for Fortran also. I made the changes on my local branch and it works great for the Intel and GNU compiler suites on Linux (those are the only ones I have access to). I modified the other compiler modules on the assumption that the options were the same for C, C++ and Fortran source files (which is true for Intel and GNU). 

I have a couple questions:

1) There are only 2 lines that needed changing in the C++ source to enable the functionality. In both places it is adding "Fortran" to the check for "C" and "C++" when assigning the `lang_is_c_or_cxx` variable. That variable name should change, but is `lang_is_c_or_cxx_or_fortran` really a good name? Seems a bit long, but it's not used often and that makes it very clear what it is storing. 

2) How would/could I go about testing the changes to the other compilers/platforms that I do not have personal access to? I'd like to verify the options work, and that I didn't miss any compilers/platforms.  

Let me know if this is something that anybody else is interested in and I can send out a patch or something to get it tested. If there is interest in including the update, I can send a patch if that's easier than setting me up for push access -- the changes are really minor.

Thanks,

Tim


More information about the cmake-developers mailing list