Docs: Update examples of specifying custom library paths to CMake

This commit is contained in:
Peter Hill 2024-02-16 10:48:34 +00:00
parent 18bd56d94b
commit 2dd7b50d2e
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE

View File

@ -1944,23 +1944,12 @@ Not at this time; it is required to instead build first one version, and then th
How can I specify linking against a particular library? {#partlib}
-------------------------------------------------------
It depends on the library. To specify a custom `ZLib`, for example, you would do the following:
$ cmake [Source Directory] -DZLIB_LIBRARY=/path/to/my/zlib.lib
`HDF5` is more complex, since it requires both the `hdf5` and `hdf5_hl` libraries. You would specify custom `HDF5` libraries as follows:
$ cmake [Source Directory] -DHDF5_C_LIBRARY=/path/to/hdf5.lib \
-DHDF5_HL_LIBRARY=/path/to/hdf5_hl.lib \
-DHDF5_INCLUDE_DIR=/path/to/hdf5/include
Alternatively, you may specify:
For most libraries, you can specify `<library name>_ROOT`. To specify
custom `ZLib` and `HDF5`, for example, you would do the following:
$ cmake [Source Directory] \
-DHDF5_LIBRARIES="/path/to/hdf5.lib;/path/to/hdf5_hl.lib" \
-DHDF5_INCLUDE_DIRS=/path/to/hdf5/include/
-DZLIB_ROOT=/path/to/zlib/install \
-DHDF5_ROOT=/path/to/hdf5/install
What if I want to link against multiple libraries in a non-standard location {#nonstdloc}
@ -1982,11 +1971,8 @@ How can I specify a Parallel Build using HDF5 {#parallelhdf}
If cmake is having problems finding the parallel `HDF5` install, you can specify the location manually:
$ cmake [Source Directory] -DENABLE_PARALLEL=ON \
-DHDF5_C_LIBRARY=/usr/lib64/openmpi/lib/libhdf5.so \
-DHDF5_HL_LIBRARY=/usr/lib64/openmpi/lib/libhdf5.hl.so \
-DHDF5_INCLUDE_DIR=/usr/include/openmpi-x86_64 \
-DHDF5_ROOT=/usr/lib64/openmpi/lib/
You will, of course, need to use the location of the libraries specific to your development environment.