Skip to content

Commit

Permalink
cmake: add version define
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Mar 11, 2024
1 parent 09b2a50 commit f154744
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
1 change: 1 addition & 0 deletions hyprcursor-util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
5 changes: 5 additions & 0 deletions hyprcursor-util/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit f154744

Please sign in to comment.