diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-06-20 12:14:18 +0200 |
---|---|---|
committer | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2021-06-20 12:14:18 +0200 |
commit | b6b95dcc9d6563666c1358e6800cc9ff064f657c (patch) | |
tree | be25dbaec76b8f18e9897334f5a6bceee131e7ae /example_packages | |
parent | e6688d07c5658b1a26354be7d7aea68231679f05 (diff) | |
download | fpm-b6b95dcc9d6563666c1358e6800cc9ff064f657c.tar.gz fpm-b6b95dcc9d6563666c1358e6800cc9ff064f657c.zip |
Allow reading version number from file
Diffstat (limited to 'example_packages')
-rw-r--r-- | example_packages/README.md | 1 | ||||
-rw-r--r-- | example_packages/version_file/VERSION | 1 | ||||
-rw-r--r-- | example_packages/version_file/app/main.f90 | 13 | ||||
-rw-r--r-- | example_packages/version_file/fpm.toml | 2 |
4 files changed, 17 insertions, 0 deletions
diff --git a/example_packages/README.md b/example_packages/README.md index b556dcb..139f8dc 100644 --- a/example_packages/README.md +++ b/example_packages/README.md @@ -22,5 +22,6 @@ the features demonstrated in each package and which versions of fpm are supporte | submodules | Lib-only; submodules (3 levels) | N | Y | | link_external | Link external library | N | Y | | link_executable | Link external library to a single executable | N | Y | +| version_file | Read version number from a file in the project root | N | Y | | with_c | Compile with `c` source files | N | Y | | with_makefile | External build command (makefile) | Y | N | diff --git a/example_packages/version_file/VERSION b/example_packages/version_file/VERSION new file mode 100644 index 0000000..ae84a9c --- /dev/null +++ b/example_packages/version_file/VERSION @@ -0,0 +1 @@ +5.42.1 diff --git a/example_packages/version_file/app/main.f90 b/example_packages/version_file/app/main.f90 new file mode 100644 index 0000000..f2ae87b --- /dev/null +++ b/example_packages/version_file/app/main.f90 @@ -0,0 +1,13 @@ +program stub + implicit none + logical :: exist + integer :: unit + character(len=100) :: line + inquire(file="VERSION", exist=exist) + if (.not.exist) error stop + open(file="VERSION", newunit=unit) + read(unit, '(a)') line + close(unit) + + print '(*(a))', "File VERSION contains '", trim(line), "'" +end program stub diff --git a/example_packages/version_file/fpm.toml b/example_packages/version_file/fpm.toml new file mode 100644 index 0000000..4dd64fd --- /dev/null +++ b/example_packages/version_file/fpm.toml @@ -0,0 +1,2 @@ +name = "version_file" +version = "VERSION" |