You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/spec/manifest.md
+45-1Lines changed: 45 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -623,7 +623,7 @@ Development dependencies allow to declare *dev-dependencies* in the manifest roo
623
623
## Installation configuration
624
624
625
625
In the *install* section components for the installation can be selected.
626
-
By default only executables are installed, library projects can set the *library* boolean to also installatation the module files and the archive.
626
+
By default only executables are installed, library projects can set the *library* boolean to also install the module files and the archive.
627
627
628
628
*Example*
629
629
@@ -632,6 +632,50 @@ By default only executables are installed, library projects can set the *library
632
632
library = true
633
633
```
634
634
635
+
### Custom module directory
636
+
637
+
:::{note}
638
+
Available since fpm v0.14.0
639
+
:::
640
+
641
+
Fortran projects generate compiled module files (`.mod`) during compilation, which contain interface information needed by other modules that use them. By default, fpm installs these module files to the `include/` directory within the installation prefix.
642
+
643
+
You can customize the installation directory for module files using the *module-dir* entry:
644
+
645
+
```toml
646
+
[install]
647
+
library = true
648
+
module-dir = "modules"
649
+
```
650
+
651
+
This is particularly useful for:
652
+
653
+
-**Separating module files from C headers**: Keep Fortran `.mod` files separate from C/C++ header files
654
+
-**Following system conventions**: Some systems expect module files in specific directories (e.g., `/usr/lib/gfortran/modules/`)
655
+
-**Organizing complex projects**: Large projects with many modules can benefit from dedicated module directories
656
+
657
+
*Example with custom module directory:*
658
+
659
+
```toml
660
+
[install]
661
+
library = true
662
+
module-dir = "fortran/modules"
663
+
```
664
+
665
+
The module directory path is relative to the installation prefix. For example, with an installation prefix of `/usr/local`, the above configuration would install module files to `/usr/local/fortran/modules/`.
666
+
667
+
*Example installation layout:*
668
+
669
+
```text
670
+
/usr/local/
671
+
├── bin/ # Executables
672
+
├── lib/ # Library archives (.a, .so, .dll)
673
+
└── fortran/
674
+
└── modules/ # Fortran module files (.mod)
675
+
```
676
+
677
+
If *module-dir* is not specified, module files are installed to the default `include/` directory alongside any header files, maintaining backward compatibility.
678
+
635
679
## Preprocessor configuration
636
680
637
681
Under the *preprocess* section, you can specify one or more preprocessor to use in an fpm project.
0 commit comments