cmake: add version define

This commit is contained in:
Vaxry 2024-03-11 22:01:46 +00:00
parent 09b2a50fe7
commit f1547443a0
3 changed files with 7 additions and 0 deletions

View file

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.19)
set(HYPRCURSOR_VERSION "0.1.2")
add_compile_definitions(HYPRCURSOR_VERSION="${HYPRCURSOR_VERSION}")
project(hyprcursor
VERSION ${HYPRCURSOR_VERSION}

View file

@ -7,6 +7,7 @@ project(
find_package(PkgConfig REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprlang>=0.4.0 libzip)
add_compile_definitions(HYPRCURSOR_VERSION="${HYPRCURSOR_VERSION}")
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")

View file

@ -448,6 +448,11 @@ int main(int argc, char** argv, char** envp) {
for (size_t i = 1; i < argc; ++i) {
std::string arg = argv[i];
if (arg == "-v" || arg == "--version") {
std::cout << "hyprcursor-util, built from v" << HYPRCURSOR_VERSION << "\n";
exit(0);
}
if (i == 1) {
// mode
if (arg == "--create" || arg == "-c") {