[CMake] Querying targets for Fortran module files & module file installation advice

Brad King brad.king at kitware.com
Wed Apr 3 10:27:13 EDT 2019


On 4/3/19 10:09 AM, Zaak Beekman wrote:
> They contain the mod files. I didn't ask for a $<config> directory to
> be created for me within the CMAKE_Fortran_MODULE_DIRECTORY but it's
> there, and all the .mod files are inside it, so `install(DIRECTORY
> ...)` is incapable (at least in my testing) of fetching them out of
> the $<config> subdirectory.

The VS generator supports multiple separate configurations being
built under the same build tree, so all artifacts such as object
files, libraries, executables, and Fortran modules need to have
a per-config location.

For libraries and executables we already have ways for projects
to specify per-config locations such that no per-config
subdirectory is added.  I've opened an issue to do the same for
Fortran modules:

  https://gitlab.kitware.com/cmake/cmake/issues/19126

Meanwhile you may be able to use `$<CONFIG>` in the source directory
specified by `install(DIRECTORY)` when CMAKE_GENERATOR is a
Visual Studio generator.

-Brad


More information about the CMake mailing list