[CMake] How to install Fortran module files?

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Fri May 10 18:01:14 EDT 2013


Hi,

If you set the CMAKE_Fortran_MODULE_DIRECTORY variable, then all module
files by default will be built into this folder. In our case we set this
to ${CMAKE_BINARY_DIR}/fortran. Since nothing else is in this folder,
you have a fairly good control over where your mod files are if you want
to install them afterwards...

I haven't really tried to install these myself, but I would imagine it
should simply be
install(DIRECTORY ${CMAKE_BINARY_DIR}/fortran DESTINATION
include/fortran/project)
(or wherever you want the module files relative to the install prefix..
Is there a correct place for them?)

Hope this helps you along somewhat.

Cheers,
Yngve

Den 10. mai 2013 19:24, skrev Neil Carlson:
> I'm trying to figure out how to install the module (.mod) files that
> are generated by the Fortran compiler.  I've only found one thread on
> the topic from 3 years ago.  The solution there was to find the
> appropriate directory in the build tree where these files were created
> and scarf up everything there that looked right and copy them to the
> desired install dir.  It looks really fragile.  Has cmake introduced
> any tools/hooks in the meantime that would simplify this, is is that
> still the way it has to be done?  I'd be interested in hearing from
> anyone that has a working solution.
>
> Thanks!
>   Neil
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130511/416b4be3/attachment.htm>


More information about the CMake mailing list