Skip to content

Commit 86c9bef

Browse files
author
Jannis Teunissen
committed
Move fpm usage description and include Cmake installation paths
1 parent 672cd36 commit 86c9bef

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

README.md

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,6 @@ fpm run --example prog
201201
with `prog` being the name of the example program (e.g., `example_sort`).
202202

203203

204-
To use `stdlib` within your `fpm` project, add the following lines to your `fpm.toml` file:
205-
```toml
206-
[dependencies]
207-
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
208-
```
209-
210-
> **Warning**
211-
>
212-
> Fpm 0.9.0 and later implements stdlib as a *metapackage*.
213-
> To include the standard library metapackage, change the dependency to:
214-
> `stdlib = "*"`.
215-
>
216-
> [see also](https://fpm.fortran-lang.org/spec/metapackages.html)
217-
218204
## Using stdlib in your project
219205

220206
### Using stdlib with CMake
@@ -237,17 +223,38 @@ target_link_libraries(
237223
To make the installed stdlib project discoverable add the stdlib directory to the ``CMAKE_PREFIX_PATH``.
238224
The usual install location of the package files is ``$PREFIX/lib/cmake/fortran_stdlib``.
239225

226+
### Using stdlib with with fpm
227+
228+
To use `stdlib` within your `fpm` project, add the following lines to your `fpm.toml` file:
229+
```toml
230+
[dependencies]
231+
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
232+
```
233+
234+
> **Warning**
235+
>
236+
> Fpm 0.9.0 and later implements stdlib as a *metapackage*.
237+
> To include the standard library metapackage, change the dependency to:
238+
> `stdlib = "*"`.
239+
>
240+
> [see also](https://fpm.fortran-lang.org/spec/metapackages.html)
241+
240242
### Using stdlib with a regular Makefile
241243

242-
The library can be included in a regular Makefile, for example with
244+
After the library has been built, it can be included in a regular Makefile.
245+
If the library has been installed in a directory inside the compiler's search path,
246+
only a flag `-lfortran_stdlib` is required to link against `libfortran_stdlib.a` or `libfortran_stdlib.so`.
247+
If the installation directory is not in the compiler's search path, one can add for example
243248
```make
244-
STDLIB_PATH := path/to/build
245-
LIBDIRS := $(STDLIB_PATH)/src
246-
INCDIRS := $(STDLIB_PATH)/src/mod_files
247-
...
249+
libdir=${install_dir}/lib
250+
moduledir=${install_dir}/include/fortran_stdlib/<compiler name and version>
251+
```
252+
Here it is assumed that the compiler will look for libraries in `libdir` and for module files in `moduledir`.
253+
The library can also be included from a build directory without installation:
254+
```make
255+
libdir=$(build_dir)/src
256+
moduledir=$(build_dir)/src/mod_files
248257
```
249-
Here it is assumed that the compiler will look for libraries in `LIBDIRS` and for module files in `INCDIRS`.
250-
A flag `-lfortran_stdlib` should be included to link against `libfortran_stdlib.a` or `libfortran_stdlib.so`.
251258

252259
## Documentation
253260

0 commit comments

Comments
 (0)