summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortastytea2020-01-03 15:59:01 +0100
committertastytea2020-01-03 15:59:43 +0100
commit59778f0d75981b1038b3f4ed6f25f4f6d6a3d656 (patch)
treecfa8febbf83262274f751727cf4075156a137448
parent2ec7809a7d04d85ec70b805848cdabd4283e6377 (diff)
downloadmastodonpp-59778f0d75981b1038b3f4ed6f25f4f6d6a3d656.tar
mastodonpp-59778f0d75981b1038b3f4ed6f25f4f6d6a3d656.tar.gz
mastodonpp-59778f0d75981b1038b3f4ed6f25f4f6d6a3d656.zip
Add version header.
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/version.hpp.in15
2 files changed, 19 insertions, 0 deletions
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 <string_view>
+
+namespace mastodonpp
+{
+
+using std::string_view;
+
+static constexpr string_view version = "@PROJECT_VERSION@";
+
+} // namespace mastodonpp
+
+#endif // MASTODONPP_VERSION_HPP