/*
 * qtmaildir - a Qt6 mail client for notmuch-indexed Maildirs
 * Copyright (C) 2026 Danilo M. <danix@danix.xyz>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#pragma once

/// Generated from the project() declaration in the top-level CMakeLists.txt.
/// The version is declared in exactly one place; anything that needs it takes
/// it from here rather than repeating the literal.
#define QTMAILDIR_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define QTMAILDIR_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define QTMAILDIR_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define QTMAILDIR_VERSION "@PROJECT_VERSION@"

/// The version as shown to a person, which in a DEV build carries the build
/// number and in a release build is exactly QTMAILDIR_VERSION.
///
/// Two separate macros deliberately. The release procedure checks `--version`
/// against a clean X.Y.Z, the SlackBuild builds from a release tarball where
/// no build counter exists, and the window title is a poor place for a number
/// that changes on every rebuild. Anything comparing versions uses
/// QTMAILDIR_VERSION; anything a person reads to answer "which build am I
/// running" uses this one.
///
/// buildnumber.h is generated at BUILD time, not here: this file is written
/// by configure_file(), which runs once per cmake run, so a counter
/// interpolated into it would sit still across every rebuild, which is the
/// entire thing item 167 is about. It defines QTMAILDIR_BUILD_NUMBER only in
/// a dev build.
#include "buildnumber.h"

#ifdef QTMAILDIR_BUILD_NUMBER
#  define QTMAILDIR_VERSION_DISPLAY QTMAILDIR_VERSION " build " QTMAILDIR_BUILD_NUMBER
#else
#  define QTMAILDIR_VERSION_DISPLAY QTMAILDIR_VERSION
#endif
