On Fri, May 10, 2013 at 4:01 PM, Yngve Inntjore Levinsen <
yngve.levin...@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?
--

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

Reply via email to