[CMake] How to install Fortran module files?
Neil Carlson
neil.n.carlson at gmail.com
Tue May 14 16:55:02 EDT 2013
On Fri, May 10, 2013 at 4:01 PM, Yngve Inntjore Levinsen <
yngve.levinsen at gmail.com> wrote:
> 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.
>
Yes, thanks! What I ended up doing is:
set(CMAKE_Fortran_MODULE_DIRECTORY $(CMAKE_BINARY_DIR}/mod_files)
install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ DESTINATION include)
With the trailing '/' on the DIRECTORY value, the mod_files directory is
not copied to the include directory but only the things it contains. Is
there a reason I shouldn't be using the CMAKE_Fortran_MODULE_DIRECTORY
variable directly in the install command?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130514/ab3a82e5/attachment-0001.htm>
More information about the CMake
mailing list