From 59778f0d75981b1038b3f4ed6f25f4f6d6a3d656 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 3 Jan 2020 15:59:01 +0100 Subject: [PATCH] Add version header. --- src/CMakeLists.txt | 4 ++++ src/version.hpp.in | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/version.hpp.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 80006e3..6968cfb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,9 @@ include(GNUInstallDirs) +# Write version in header. +configure_file ("version.hpp.in" + "${PROJECT_BINARY_DIR}/version.hpp" @ONLY) + add_library(${PROJECT_NAME}) file(GLOB_RECURSE sources_lib *.cpp) diff --git a/src/version.hpp.in b/src/version.hpp.in new file mode 100644 index 0000000..c9ea040 --- /dev/null +++ b/src/version.hpp.in @@ -0,0 +1,15 @@ +#ifndef MASTODONPP_VERSION_HPP +#define MASTODONPP_VERSION_HPP + +#include + +namespace mastodonpp +{ + +using std::string_view; + +static constexpr string_view version = "@PROJECT_VERSION@"; + +} // namespace mastodonpp + +#endif // MASTODONPP_VERSION_HPP