[CMake] What is the proper way to handle additional non-object files generated by compilation?
Maik Beckmann
beckmann.maik at googlemail.com
Fri May 23 01:07:29 EDT 2008
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)
Best,
-- Maik
More information about the CMake
mailing list