diff options
author | ConfuSomu | 2024-01-07 16:15:57 +0100 |
---|---|---|
committer | ConfuSomu | 2024-01-07 16:18:27 +0100 |
commit | 58240fa2e1ac4234cf67374349ce606f1b6df643 (patch) | |
tree | 9e36f4e1b772d770071b4d963a91d2d61baced42 | |
parent | aab83a2066b5e8c2172a43b0b1674b21e903d991 (diff) | |
download | ActorViewer-58240fa2e1ac4234cf67374349ce606f1b6df643.tar ActorViewer-58240fa2e1ac4234cf67374349ce606f1b6df643.tar.gz ActorViewer-58240fa2e1ac4234cf67374349ce606f1b6df643.zip |
Use configure_file instead of setting compile defs
This should avoid unnecessary recompiles of the whole project when the
git hash changes and the project is reconfigured.
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | gen/git_version.h.in | 3 | ||||
-rw-r--r-- | src/aboutdialog.cpp | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ac0bc1d..68c3d28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,11 +119,8 @@ else() endif() endif() -if (GIT_DESCRIBE_TEXT) - target_compile_definitions(ActorViewer PRIVATE GIT_DESCRIBE_TEXT=${GIT_DESCRIBE_TEXT}) -else() - target_compile_definitions(ActorViewer PRIVATE GIT_COMMIT_HASH=${GIT_COMMIT_HASH}) -endif() +configure_file(gen/git_version.h.in gen/git_version.h) +target_include_directories(ActorViewer PRIVATE gen) target_link_libraries(ActorViewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets mastodonpp) diff --git a/gen/git_version.h.in b/gen/git_version.h.in new file mode 100644 index 0000000..8732171 --- /dev/null +++ b/gen/git_version.h.in @@ -0,0 +1,3 @@ +#pragma once +#cmakedefine GIT_DESCRIBE_TEXT ${GIT_DESCRIBE_TEXT} +#cmakedefine GIT_COMMIT_HASH ${GIT_COMMIT_HASH} diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp index 3583a5e..ac670bb 100644 --- a/src/aboutdialog.cpp +++ b/src/aboutdialog.cpp @@ -1,5 +1,6 @@ #include "aboutdialog.h" -#include <qsizepolicy.h> +#include "gen/git_version.h" +#include <QSizePolicy> AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent, Qt::Dialog), ui(new Ui::AboutDialog) |