added version injection through `cmake`

development
Michael Ochmann 2 years ago
parent 3456e92a40
commit d5448fb919
  1. 6
      CMakeLists.txt
  2. 6
      main.cpp

@ -12,13 +12,15 @@ set(EXE_NAME "qr_${CMAKE_PROJECT_VERSION}-${ARCH}")
project( project(
qr qr
VERSION 1.0.0 VERSION 1.0.1
LANGUAGES CXX LANGUAGES CXX
) )
message(STATUS "ARCH:: ${ARCH}") message(STATUS "ARCH:: ${ARCH}")
file(GLOB_RECURSE sources main.cpp src/*.hpp src/*.cpp lib/*.hpp lib/*.cpp) configure_file(main.cpp main_substitute.cpp)
file(GLOB_RECURSE sources main_substitute.cpp src/*.hpp src/*.cpp lib/*.hpp lib/*.cpp)
add_executable(qr ${sources}) add_executable(qr ${sources})
set_target_properties(qr PROPERTIES OUTPUT_NAME ${EXE_NAME}) set_target_properties(qr PROPERTIES OUTPUT_NAME ${EXE_NAME})

@ -7,7 +7,8 @@
#define UNUSED(var) (void) var; #define UNUSED(var) (void) var;
constexpr const char* VERSION = "1.0.0"; // Version is injected through cmake
constexpr const char* VERSION = "@qr_VERSION@";
void printHelp() { void printHelp() {
std::string helpText = R"EOF( std::string helpText = R"EOF(
@ -22,6 +23,9 @@ Usage:
-o --output output file name -o --output output file name
-s --size desired output file size in pixels -s --size desired output file size in pixels
-t --type output QR code type. can be one of "small, medium, large" -t --type output QR code type. can be one of "small, medium, large"
In pixel based renderers (i.e. PNG), the output size may not be exactly as
specified but be the nearest multiple of the actual cell size for the QR code.
)EOF"; )EOF";
std::cout << "qr " << VERSION; std::cout << "qr " << VERSION;
std::cout << helpText << std::endl; std::cout << helpText << std::endl;

Loading…
Cancel
Save