Skip to content
Snippets Groups Projects
Commit f7c8434f authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Capture git branch and output

parent 919adaea
No related branches found
No related tags found
No related merge requests found
Pipeline #11288 passed
...@@ -8,6 +8,14 @@ if (Git_FOUND) ...@@ -8,6 +8,14 @@ if (Git_FOUND)
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
RESULT_VARIABLE GIT_RESULT RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE VERSION OUTPUT_VARIABLE VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND
"${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE BRANCH
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#cmakedefine HAVE_NANOGUI #cmakedefine HAVE_NANOGUI
#cmakedefine HAVE_LIBARCHIVE #cmakedefine HAVE_LIBARCHIVE
extern const char *FTL_BRANCH;
extern const char *FTL_VERSION_LONG; extern const char *FTL_VERSION_LONG;
extern const char *FTL_VERSION; extern const char *FTL_VERSION;
extern const int FTL_VERSION_MAJOR; extern const int FTL_VERSION_MAJOR;
......
#include <ftl/config.h> #include <ftl/config.h>
const char *FTL_BRANCH = "@BRANCH@";
const char *FTL_VERSION_LONG = "@VERSION@"; const char *FTL_VERSION_LONG = "@VERSION@";
const char *FTL_VERSION = ""; const char *FTL_VERSION = "";
const int FTL_VERSION_MAJOR = 0; const int FTL_VERSION_MAJOR = 0;
......
...@@ -49,7 +49,7 @@ static Configurable *rootCFG = nullptr; ...@@ -49,7 +49,7 @@ static Configurable *rootCFG = nullptr;
bool ftl::running = true; bool ftl::running = true;
int ftl::exit_code = 0; int ftl::exit_code = 0;
std::string ftl::branch_name = ""; std::string ftl::branch_name = FTL_BRANCH;
bool ftl::is_directory(const std::string &path) { bool ftl::is_directory(const std::string &path) {
#ifdef WIN32 #ifdef WIN32
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment