fortran-lang / fpm-docs

Documentation repository for the Fortran package manager (fpm)
https://fpm.fortran-lang.org
MIT License
34 stars 21 forks source link

Source file scoping specification #94

Open zoziha opened 1 year ago

zoziha commented 1 year ago

Description

There is a source file scoping specification in the fpm developer specification, but it is somewhat hidden and not obvious, and it is important enough to be included in the user documentation.

Specification contents:

## Source file scoping
Source files are assigned a scope of either FPM_SCOPE_LIB, FPM_SCOPE_APP or FPM_SCOPE_TEST.
The scope controls which modules may be used by the source file:

- Library sources (FPM_SCOPE_LIB) may only use modules also with library scope.
  This includes library modules from dependencies.

- Executable sources (FPM_SCOPE_APP,FPM_SCOPE_TEST) may use library modules (including dependencies)
  as well as any modules corresponding to source files in the same directory
  or a subdirectory of the executable source file.

Links

  1. intended design
  2. specification
  3. Unable to find dependency from parent directory when building exe