From 3a8ae77477b6e2e477f386c355b26e65908f6796 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 23 Oct 2020 16:58:41 +0200 Subject: [PATCH] Improve handling configuration suffix * Use configuration suffix when installing icons * Include configuration name suffix in application name This way differently configured versions of the same applications should be co-installable within the same prefix. That is useful to install the Qt 6 version of an application alongside the Qt 5 version. --- CMakeLists.txt | 2 +- cmake/modules/AppTarget.cmake | 5 ++++- cmake/modules/BasicConfig.cmake | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b059e0..9afd534 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ set(META_APP_DESCRIPTION "Useful C++ classes and routines such as argument parse set(META_FEATURES_FOR_COMPILER_DETECTION_HEADER cxx_thread_local) set(META_VERSION_MAJOR 5) set(META_VERSION_MINOR 7) -set(META_VERSION_PATCH 0) +set(META_VERSION_PATCH 1) # find required 3rd party libraries include(3rdParty) diff --git a/cmake/modules/AppTarget.cmake b/cmake/modules/AppTarget.cmake index 5667c4c..9ce7daa 100644 --- a/cmake/modules/AppTarget.cmake +++ b/cmake/modules/AppTarget.cmake @@ -135,8 +135,11 @@ if (NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS) endforeach () foreach (ICON_FILE ${ICON_FILES}) + get_filename_component(ICON_FILE_NAME "${ICON_FILE}" NAME_WE) + get_filename_component(ICON_FILE_EXT "${ICON_FILE}" EXT) install( FILES "${ICON_FILE}" + RENAME "${ICON_FILE_NAME}${META_CONFIG_SUFFIX}${ICON_FILE_EXT}" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" COMPONENT desktop) endforeach () @@ -243,7 +246,7 @@ function (add_desktop_file) DESKTOP_FILE_CMD "${META_TARGET_NAME}" DESKTOP_FILE_ICON - "${META_PROJECT_NAME}" + "${META_PROJECT_NAME}${META_CONFIG_SUFFIX}" DESKTOP_FILE_ADDITIONAL_ENTRIES "${DESKTOP_FILE_ADDITIONAL_ENTRIES}") diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 74cc113..cb3c752 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -50,6 +50,7 @@ endif () if (META_CONFIG_NAME) set(META_CONFIG_PREFIX "${META_CONFIG_NAME}-") set(META_CONFIG_SUFFIX "-${META_CONFIG_NAME}") + set(META_APP_NAME "${META_APP_NAME} (${META_CONFIG_NAME})") endif () # allow setting a library/application target suffix - A different configuration name might not require a different target