From 9cb3ae7de10f7c99f48f7a7ee5d0597630d26815 Mon Sep 17 00:00:00 2001 From: SpomJ <75751809+SpomJ@users.noreply.github.com> Date: Mon, 31 Mar 2025 17:36:29 +0300 Subject: [PATCH] Add build flags to output of lmms --version (#7780) --- src/CMakeLists.txt | 12 ++++++++++++ src/core/main.cpp | 7 ++++--- src/lmmsversion.h.in | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9612190bf..eb69fd1a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,18 @@ ADD_SUBDIRECTORY(3rdparty) CONFIGURE_FILE("lmmsconfig.h.in" "${CMAKE_BINARY_DIR}/lmmsconfig.h") + +# Provide config flags to lmmsversion.h +get_cmake_property(_define_vars VARIABLES) +foreach (_define_var ${_define_vars}) + if(_define_var MATCHES "^WANT|LMMS_(HAVE|DEBUG)" ) + list(APPEND LMMS_BUILD_OPTIONS "${_define_var}='${${_define_var}}'") + endif() +endforeach() + +# Format for readibility +string(REPLACE ";" " " LMMS_BUILD_OPTIONS "${LMMS_BUILD_OPTIONS}") + CONFIGURE_FILE("lmmsversion.h.in" "${CMAKE_BINARY_DIR}/lmmsversion.h") SET(LMMS_SRCS "") diff --git a/src/core/main.cpp b/src/core/main.cpp index 995b49d2c..c75e91ccd 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -140,15 +140,16 @@ inline void loadTranslation( const QString & tname, void printVersion( char *executableName ) { - printf( "LMMS %s\n(%s %s, Qt %s, %s)\n\n" + printf("LMMS %s\n(%s %s, Qt %s, %s)\n\n" + "Build options:\n%s\n\n" "Copyright (c) %s\n\n" "This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public\n" "License as published by the Free Software Foundation; either\n" "version 2 of the License, or (at your option) any later version.\n\n" "Try \"%s --help\" for more information.\n\n", LMMS_VERSION, - LMMS_BUILDCONF_PLATFORM, LMMS_BUILDCONF_MACHINE, QT_VERSION_STR, LMMS_BUILDCONF_COMPILER_VERSION, - LMMS_PROJECT_COPYRIGHT, executableName ); + LMMS_BUILDCONF_PLATFORM, LMMS_BUILDCONF_MACHINE, QT_VERSION_STR, LMMS_BUILDCONF_COMPILER_VERSION, LMMS_BUILD_OPTIONS, + LMMS_PROJECT_COPYRIGHT, executableName); } diff --git a/src/lmmsversion.h.in b/src/lmmsversion.h.in index dc7ae84d0..47bdba52a 100644 --- a/src/lmmsversion.h.in +++ b/src/lmmsversion.h.in @@ -1,2 +1,3 @@ #define LMMS_VERSION "@VERSION@" #define LMMS_PROJECT_COPYRIGHT "@PROJECT_COPYRIGHT@" +#define LMMS_BUILD_OPTIONS "@LMMS_BUILD_OPTIONS@"