File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,34 @@ cmake --build build
5050cmake --install build
5151```
5252
53- then to link into your existing program from the command line (if not using CMake FetchContent as is suggested):
53+ then to link into your existing program from the command line
54+
55+ using CMake from your project
56+
57+ ``` sh
58+ cmake -B build -Dh5fortran_DIR=~ /lib/h5fortran/lib/cmake/h5fortran
59+ ```
60+
61+ and in your CMakeLists.txt
62+
63+ ``` cmake
64+ find_package(h5fortran CONFIG)
65+
66+ if(h5fortran_FOUND)
67+ include(${h5fortran_DIR}/h5fortranTargets.cmake)
68+ else()
69+ include(FetchContent)
70+ FetchContent_Declare(h5fortran_proj
71+ GIT_REPOSITORY https://github.com/geospace-code/h5fortran.git
72+ GIT_TAG v3.0.1)
73+ FetchContent_MakeAvailable(h5fortran_proj)
74+ endif()
75+ ```
76+
77+ if not using CMake FetchContent as is suggested:
5478
5579``` sh
56- gfortran -I~/lib/h5fortran/include myprogram.f90 ~ /lib/h5fortran/libh5fortran.a
80+ gfortran -I~/lib/h5fortran/include myprogram.f90 ~ /lib/h5fortran/lib/ libh5fortran.a
5781```
5882
5983### [ optional] create distributable archive
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Compilers known to work include:
5353* Gfortran &ge ; 6
5454* Intel compiler &ge ; 19.1 / 2020
5555
56- ## Install
56+ ## Build
5757
5858Using CMake:
5959
You can’t perform that action at this time.
0 commit comments