Commit 61a46504 authored by williangaspar's avatar williangaspar
parent c0084a28
build/
build-*/
tests/runtime/*.pyc
/src/version.h
......@@ -30,3 +30,17 @@ if (KERNEL_HEADERS_DIR)
MESSAGE(STATUS "Using KERNEL_HEADERS_DIR=${KERNEL_HEADERS_DIR}")
target_compile_definitions(bpftrace PUBLIC KERNEL_HEADERS_DIR="${KERNEL_HEADERS_DIR}")
endif()
execute_process(
COMMAND git describe --abbrev=4 --dirty --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DVERSION=${GIT_VERSION}")
configure_file(
${CMAKE_SOURCE_DIR}/src/version.h.in
${CMAKE_SOURCE_DIR}/src/version.h
)
......@@ -12,6 +12,7 @@
#include "printer.h"
#include "semantic_analyser.h"
#include "tracepoint_format_parser.h"
#include "version.h"
using namespace bpftrace;
......@@ -75,6 +76,12 @@ int main(int argc, char *argv[])
char *cmd_str = nullptr;
bool listing = false;
if (argc > 1 && strcmp(argv[1], "--version") == 0)
{
std::cout << "bpfTrace " << GIT_VERSION << "\n" << std::endl;
return 0;
}
std::string script, search;
int c;
while ((c = getopt(argc, argv, "de:hlp:vc:")) != -1)
......
#ifndef VERSION_H
#define VERSION_H
#define GIT_VERSION "@GIT_VERSION@"
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment