[CMake] What is the proper way to handle additional non-object files generated by compilation?

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri May 23 02:57:21 EDT 2008


On 2008-05-23 07:07+0200 Maik Beckmann wrote:

> Am Freitag 23 Mai 2008 01:08:46 schrieb Alan W. Irwin:
>> On 2008-05-21 18:25-0700 Alan W. Irwin wrote:
>>> I am finally working again on the CMake language support for Ada
>>> (currently implemented just for the gcc gnatmake compiler).  One of the
>>> issues is the gnatmake compiler not only produces *.o object files but
>>> also *.ali (Ada library information) files, and I haven't figured out how
>>> to get the *.ali files automatically removed by "make clean" using my Ada
>>> language support files.
>>>
>>> Currently, I am using
>>>
>>> SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ...)
>>>
>>> to get "make clean" to work for the generated *.ali files, but I am
>>> concerned this is just a workaround for some limitation in my current Ada
>>> language support files.
>>>
>>> A similar situation appears for Fortran 90 compilers which generate both
>>> "module" files and standard object files.  I have just proved to my
>>> satisfaction that "make clean" works for those generated module files (at
>>> least for cmake-2.6.0 and gfortran module files with the extension .mod
>>> that are generated by the PLplot build).
>>>
>>> If that correct "make clean" result for Fortran module files is set up in
>>> the CMake Fortran language support files, please point me to the area,
>>> and I can probably do the rest for the Ada case.
>>
>> To phrase the question more directly for the Fortran 90 experts here, how
>> does CMake implement "make clean" for the module files that are generated
>> by Fortran 90 compilers?  I would really appreciate an answer since I would
>> like to do something similar for the Ada case.
>>
>> Alan
>>
>
> All target directories, Fortran or not,  contain a cmake_clean.cmake, i.e.
>  CMakeFiles/foolib.dir/cmake_clean.cmake
> which in turn contains
> {{{
> #...
> # Per-language clean rules from dependency scanning.
> FOREACH(lang Fortran)
>  INCLUDE(CMakeFiles/libfoo.dir/cmake_clean_${lang}.cmake OPTIONAL)
> ENDFOREACH(lang)
> }}}
>
> The CMakeFiles/foolib.dir/cmake_clean_Fortran.cmake looks like this
> {{{
> # Remove fortran modules provided by this target.
> FILE(REMOVE
>  "mathconstants.mod"
>  "MATHCONSTANTS.mod"
>  "CMakeFiles/wzl_fortran.dir/mathconstants.mod.stamp"
>
>  # ... for  all mod files
> )
> }}}
>
> I bet this is what you're searching for :o)

Thanks for your response.  Of course, what I would really like to know is
how that list of *.mod files is set up by CMake.  Does anybody here know that?

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list