File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ if (NOT CMAKE_CXX_STANDARD)
2424 set (CMAKE_CXX_STANDARD 17)
2525endif ()
2626
27+ file (READ version .txt VERSION_STR)
28+ string (STRIP ${VERSION_STR} VERSION_STR)
29+
2730find_path (SIMPLEINI_INCLUDE_DIRS "ConvertUTF.c" )
2831if (SIMPLEINI_INCLUDE_DIRS)
2932 message (STATUS "SIMPLEINI_INCLUDE_DIRS: ${SIMPLEINI_INCLUDE_DIRS} " )
@@ -36,4 +39,5 @@ find_package(RdKafka CONFIG REQUIRED)
3639find_package (argparse CONFIG REQUIRED)
3740
3841add_executable (snctl-cpp main.cc)
42+ target_compile_definitions (snctl-cpp PUBLIC VERSION_STR="${VERSION_STR} " )
3943target_link_libraries (snctl-cpp PRIVATE argparse::argparse RdKafka::rdkafka)
Original file line number Diff line number Diff line change 3232#include < vector>
3333
3434int main (int argc, char *argv[]) {
35- const auto version = " 0.1.0" ;
36-
3735 std::vector<std::string> default_config_paths{
3836 std::filesystem::current_path () / " sncloud.ini" ,
3937 std::filesystem::path (std::getenv (" HOME" )) / " .snctl-cpp" /
4038 " sncloud.ini" };
4139
42- argparse::ArgumentParser program (" snctl-cpp" , version);
40+ argparse::ArgumentParser program (" snctl-cpp" ,
41+ #ifdef VERSION_STR
42+ VERSION_STR
43+ #else
44+ " unknown"
45+ #endif
46+ );
4347 program.add_argument (" --config" )
4448 .default_value (default_config_paths)
4549 .help (" Path to the config file" );
Original file line number Diff line number Diff line change 1+ 0.1.1
You can’t perform that action at this time.
0 commit comments