diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aa20f30..256cc6ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,11 @@ else() add_definitions(-DGLOBAL_DEBUG=PROGRESS_LOG_INFO) endif() +set(PROGRESS_VERSION "${PROJECT_VERSION}") +add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}") +add_definitions(-DPROGRESS_VERSION=${PROGRESS_VERSION}) +message(STATUS "Setting PROGRESS_VERSION to '${PROGRESS_VERSION}'") + set(GNU_C_FLAGS_DEBUG -O0 -g -Wall -Wimplicit -Wno-unknown-pragmas --coverage -save-temps -std=c99) set(GNU_C_FLAGS_RELEASE -O3 -g -std=c99) diff --git a/src/prg_progress_mod.F90 b/src/prg_progress_mod.F90 index c6f5da81..b25bdbf2 100644 --- a/src/prg_progress_mod.F90 +++ b/src/prg_progress_mod.F90 @@ -3,6 +3,15 @@ ! ! +#ifdef __GFORTRAN__ +# define STRINGIFY_START(X) "& +# define STRINGIFY_END(X) &X" +#else /* default stringification */ +# define STRINGIFY_(X) #X +# define STRINGIFY_START(X) & +# define STRINGIFY_END(X) STRINGIFY_(X) +#endif + module prg_progress_mod use bml @@ -15,11 +24,24 @@ module prg_progress_mod integer, parameter :: dp = kind(1.0d0) + public :: prg_version public :: prg_progress_init public :: prg_progress_shutdown contains + !> Print PROGRESS and BML versions + subroutine prg_version() + character (len=:), allocatable :: astring + astring = STRINGIFY_START(PROGRESS_VERSION) + STRINGIFY_END(PROGRESS_VERSION) + write(6,*) 'QMD-PROGRESS and BML are used!' + write(6,*) 'QMD-PROGRESS VERSION: ', astring + call bml_print_version() + write(6,*) + + end subroutine prg_version + !> Initialize progress. subroutine prg_progress_init()