summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-08-27 14:35:13 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-08-27 14:35:13 +0200
commitaae3a5a9180fe2917d14b437931bd9fe14e933e1 (patch)
tree4fb3c823e0ee77da3e5279336ad933e1fa972f5a
parent0c43a9579f7076b0215b4198a7dd5f10d32e2391 (diff)
downloadcssh-aae3a5a9180fe2917d14b437931bd9fe14e933e1.tar.gz
cssh-aae3a5a9180fe2917d14b437931bd9fe14e933e1.tar.bz2
made version of gengetopt file and version.h depend on CSSH_VERSION in CMakeLists.txt
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/cssh.c3
-rw-r--r--src/options.ggo.in (renamed from src/cssh_options.ggo)2
-rw-r--r--src/version.h.in6
5 files changed, 17 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e238887..807c838 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ include(cmake/gengetopt.cmake)
project(cssh C)
+set( CSSH_VERSION 0.0.1 )
+
set(CMAKE_C_FLAGS "-std=c99 -Wall -pedantic -Wfatal-errors -Werror -fPIC -O0 -Wno-unused-but-set-variable -g -D_XOPEN_SOURCE=700")
add_subdirectory(src)
@@ -14,3 +16,9 @@ add_custom_target(distclean
COMMAND make clean
COMMAND git clean -d -f -x
)
+
+configure_file( "${PROJECT_SOURCE_DIR}/src/version.h.in"
+ "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY )
+
+configure_file( "${PROJECT_SOURCE_DIR}/src/options.ggo.in"
+ "${PROJECT_SOURCE_DIR}/src/options.ggo" @ONLY )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71a8023..c8acde1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,7 +5,7 @@ set(SRC
msleep.c
)
-ADD_GENGETOPT_FILES(SRC cssh_options.ggo)
+ADD_GENGETOPT_FILES(SRC options.ggo)
add_executable(cssh ${SRC})
diff --git a/src/cssh.c b/src/cssh.c
index c1508f3..88a3dd7 100644
--- a/src/cssh.c
+++ b/src/cssh.c
@@ -13,8 +13,7 @@
#include "msleep.h"
#include "cssh_options.h"
-
-#define CSSH_VERSION "0.0.1"
+#include "version.h"
static int parse_options_and_arguments( int argc, char *argv[], struct gengetopt_args_info *args_info ) {
cmdline_parser_init( args_info );
diff --git a/src/cssh_options.ggo b/src/options.ggo.in
index 6f1fc11..9f70ca4 100644
--- a/src/cssh_options.ggo
+++ b/src/options.ggo.in
@@ -1,5 +1,5 @@
package "cssh"
-version "0.0.1"
+version "@CSSH_VERSION@"
usage "cssh [options] [user@][hostname] [command]"
description "Execute a command on a set of machines"
diff --git a/src/version.h.in b/src/version.h.in
new file mode 100644
index 0000000..aff2102
--- /dev/null
+++ b/src/version.h.in
@@ -0,0 +1,6 @@
+#ifndef CSSH_VERSION_H_INCLUDED
+#define CSSH_VERSION_H_INCLUDED
+
+#define CSSH_VERSION "@CSSH_VERSION@"
+
+#endif