aboutsummaryrefslogtreecommitdiff
path: root/example_packages/version_file/app/main.f90
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-06-23 11:02:14 +0100
committerGitHub <noreply@github.com>2021-06-23 11:02:14 +0100
commitd693d685d033c0da9c24686d61fdf6ede2caa7e4 (patch)
treee8b8640efe12ac729851f2992e6243658b5922de /example_packages/version_file/app/main.f90
parent0372313a91263789c843623fca0aab9a4e340e19 (diff)
parent63288a62ceeb20c53ba656b89c0f7c709ad9dbaa (diff)
downloadfpm-d693d685d033c0da9c24686d61fdf6ede2caa7e4.tar.gz
fpm-d693d685d033c0da9c24686d61fdf6ede2caa7e4.zip
Merge pull request #500 from awvwgk/version-file
Allow reading version number from file
Diffstat (limited to 'example_packages/version_file/app/main.f90')
-rw-r--r--example_packages/version_file/app/main.f9013
1 files changed, 13 insertions, 0 deletions
diff --git a/example_packages/version_file/app/main.f90 b/example_packages/version_file/app/main.f90
new file mode 100644
index 0000000..fcf8d64
--- /dev/null
+++ b/example_packages/version_file/app/main.f90
@@ -0,0 +1,13 @@
+program stub
+ implicit none
+ logical :: exists
+ integer :: unit
+ character(len=100) :: line
+ inquire(file="VERSION", exist=exists)
+ if (.not.exists) error stop "File VERSION does not exist."
+ open(file="VERSION", newunit=unit)
+ read(unit, '(a)') line
+ close(unit)
+
+ print '(*(a))', "File VERSION contains '", trim(line), "'"
+end program stub