Commit 8aeae40d authored by Brendan Gregg's avatar Brendan Gregg Committed by GitHub

Merge pull request #343 from iovisor/version

Add --version
parents 96389e4a eab36756
......@@ -30,3 +30,12 @@ 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 BPFTRACE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DBPFTRACE_VERSION=\"${BPFTRACE_VERSION}\"")
\ No newline at end of file
......@@ -75,6 +75,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 " << BPFTRACE_VERSION<< "\n" << std::endl;
return 0;
}
std::string script, search;
int c;
while ((c = getopt(argc, argv, "de:hlp:vc:")) != -1)
......
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