@@ -201,20 +201,6 @@ fpm run --example prog
201
201
with ` prog ` being the name of the example program (e.g., ` example_sort ` ).
202
202
203
203
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
-
218
204
## Using stdlib in your project
219
205
220
206
### Using stdlib with CMake
@@ -237,17 +223,38 @@ target_link_libraries(
237
223
To make the installed stdlib project discoverable add the stdlib directory to the `` CMAKE_PREFIX_PATH `` .
238
224
The usual install location of the package files is `` $PREFIX/lib/cmake/fortran_stdlib `` .
239
225
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
+
240
242
### Using stdlib with a regular Makefile
241
243
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
243
248
``` 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
248
257
```
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 ` .
251
258
252
259
## Documentation
253
260
0 commit comments