Add version header.

This commit is contained in:
tastytea 2020-01-03 15:59:01 +01:00
parent 2ec7809a7d
commit 59778f0d75
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 19 additions and 0 deletions

View File

@ -1,5 +1,9 @@
include(GNUInstallDirs) include(GNUInstallDirs)
# Write version in header.
configure_file ("version.hpp.in"
"${PROJECT_BINARY_DIR}/version.hpp" @ONLY)
add_library(${PROJECT_NAME}) add_library(${PROJECT_NAME})
file(GLOB_RECURSE sources_lib *.cpp) file(GLOB_RECURSE sources_lib *.cpp)

15
src/version.hpp.in Normal file
View File

@ -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