make sure that git repo info is only added if the musrfit project source is indeed a git repo, and not e.g. a download.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
#--- musrWiz for Qt > 6.0 -----------------------------------------------------
|
||||
|
||||
#--- check if project source is repo ------------------------------------------
|
||||
if (IS_GIT_REPO)
|
||||
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
|
||||
else (IS_GIT_REPO)
|
||||
set(HAVE_GIT_REV_H "")
|
||||
endif (IS_GIT_REPO)
|
||||
|
||||
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg Qt6::Xml)
|
||||
|
||||
set(musrWiz_src
|
||||
@@ -51,6 +58,11 @@ target_include_directories(musrWiz
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
|
||||
)
|
||||
|
||||
target_compile_options(musrWiz
|
||||
PRIVATE
|
||||
"${HAVE_GIT_REV_H}"
|
||||
)
|
||||
|
||||
target_link_libraries(musrWiz ${qt_libs})
|
||||
|
||||
#--- installation info --------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
#include "git-revision.h"
|
||||
#endif
|
||||
|
||||
#include "musrWiz.h"
|
||||
#include "PAdmin.h"
|
||||
#include "PMusrWiz.h"
|
||||
@@ -53,7 +56,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc == 2) {
|
||||
if (!strcmp(argv[1], "--version") || (!strcmp(argv[1], "-v"))) {
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
std::cout << std::endl << "musrWiz - git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl;
|
||||
#else
|
||||
std::cout << std::endl << "musrWiz - git-branch: unknown, git-rev: unknown." << std::endl << std::endl;
|
||||
#endif
|
||||
return 0;
|
||||
} else if (!strcmp(argv[1], "--help")) {
|
||||
musrWiz_syntax();
|
||||
|
||||
Reference in New Issue
Block a user