mirror of
https://github.com/fmang/opustags.git
synced 2025-01-16 05:03:13 +01:00
get the version number from the cmake project
This commit is contained in:
parent
65aad6f62a
commit
a3e7624866
@ -12,6 +12,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(OGG REQUIRED ogg)
|
||||
|
||||
configure_file(config.h.in config.h @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(opustags opustags.cc)
|
||||
target_compile_options(opustags PUBLIC ${OGG_CFLAGS})
|
||||
target_link_libraries(opustags PUBLIC ${OGG_LIBRARIES})
|
||||
|
2
config.h.in
Normal file
2
config.h.in
Normal file
@ -0,0 +1,2 @@
|
||||
#cmakedefine PROJECT_NAME "@PROJECT_NAME@"
|
||||
#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@"
|
@ -1,3 +1,5 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <limits.h>
|
||||
@ -165,7 +167,7 @@ int write_page(ogg_page *og, FILE *stream){
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *version = "opustags version 1.1.1\n";
|
||||
const char *version = PROJECT_NAME " version " PROJECT_VERSION "\n";
|
||||
|
||||
const char *usage =
|
||||
"Usage: opustags --help\n"
|
||||
|
11
t/meta.t
11
t/meta.t
@ -4,22 +4,23 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 7;
|
||||
|
||||
my $opustags = './opustags';
|
||||
chomp(my $version = `git describe --tags --abbrev=0`);
|
||||
|
||||
BAIL_OUT("$opustags does not exist or is not executable") if (! -x $opustags);
|
||||
|
||||
chomp(my $version = `$opustags --help | head -n 1`);
|
||||
like($version, qr/^opustags version \d+\.\d+\.\d+$/, 'get the version string');
|
||||
|
||||
is(`$opustags`, <<"EOF", 'no options show the usage');
|
||||
opustags version $version
|
||||
$version
|
||||
Usage: opustags --help
|
||||
opustags [OPTIONS] FILE
|
||||
opustags OPTIONS FILE -o FILE
|
||||
EOF
|
||||
|
||||
my $help = <<"EOF";
|
||||
opustags version $version
|
||||
$version
|
||||
|
||||
Usage: opustags --help
|
||||
opustags [OPTIONS] FILE
|
||||
|
Loading…
x
Reference in New Issue
Block a user