diff options
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/version.hpp.in | 15 |
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 |