Skip to content

Linux + iPhone Continuity / iMessage / SMS

tie in version

Zack Bartelef0efa646ed3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f33ffbf..f855ead 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,30 @@
cmake_minimum_required(VERSION 3.19)
-project(tether VERSION 0.1.0 LANGUAGES CXX C)
+project(tether VERSION 0.0.0 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+# version from git
+execute_process(
+ COMMAND git describe --tags --always --dirty
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+)
+
+if(GIT_VERSION)
+ string(REGEX REPLACE "^v" "" TETHER_VERSION "${GIT_VERSION}")
+else()
+ set(TETHER_VERSION "${PROJECT_VERSION}-unknown")
+endif()
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/core/include/tether/version.hpp.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/generated/tether/version.hpp"
+ @ONLY
+)
+
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(WAYLAND REQUIRED IMPORTED_TARGET wayland-client)
@@ -125,7 +146,8 @@ set(CPACK_PACKAGE_RELOCATABLE FALSE)
set(CPACK_PACKAGE_NAME "tether")
set(CPACK_PACKAGE_VENDOR "zackb")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Wayland-native local file transfer and clipboard sync tool over mDNS")
-set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
+set(CPACK_PACKAGE_VERSION "${TETHER_VERSION}")
+
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "tether")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 9443569..5cb94c5 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -17,9 +17,11 @@ pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0 gio-2.0)
target_include_directories(tether PUBLIC
include
+ ${CMAKE_BINARY_DIR}/generated
)
-target_link_libraries(tether PUBLIC
+
+target_link_libraries(tether PUBLIC
nlohmann_json::nlohmann_json
PkgConfig::WAYLAND
OpenSSL::SSL
diff --git a/src/core/include/tether/version.hpp.in b/src/core/include/tether/version.hpp.in
new file mode 100644
index 0000000..0a1d697
--- /dev/null
+++ b/src/core/include/tether/version.hpp.in
@@ -0,0 +1,3 @@
+#pragma once
+
+#define TETHER_VERSION "@TETHER_VERSION@"
diff --git a/src/core/src/core.cpp b/src/core/src/core.cpp
index 80f39d0..2407ad1 100644
--- a/src/core/src/core.cpp
+++ b/src/core/src/core.cpp
@@ -1,7 +1,8 @@
-#include "tether/core.hpp"
+#include <tether/core.hpp>
+#include <tether/version.hpp>
namespace tether {
- std::string get_version() { return "0.1.0"; }
+ std::string get_version() { return TETHER_VERSION; }
} // namespace tether