From af866d7306d960bfd5c00d0e5d4dfeed39d19a95 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sun, 24 Nov 2024 19:19:24 +0100 Subject: [PATCH] set major versions via variables for Qt Creator version --- CMakeLists.txt | 10 +++++++++- packaging/cpack.cmake | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ede2021..80294104 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,14 @@ cmake_minimum_required(VERSION 3.10) +project(LANGUAGES CXX) -project(ROSProjectManager VERSION 15.0) +# get Qt Creator major version +find_package(QtCreator REQUIRED) +string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)?$" QTC_VER_COMPAT ${IDE_VERSION_COMPAT}) +set(QTC_COMPAT_MAJOR ${CMAKE_MATCH_1}) +string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" QTC_VER_DISPLAY ${IDE_VERSION_DISPLAY}) +set(QTC_DISPLAY_MAJOR ${CMAKE_MATCH_1}) + +project(ROSProjectManager VERSION ${QTC_DISPLAY_MAJOR}.0) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Werror -Wall -Wextra -Wpedantic -Wsuggest-override) diff --git a/packaging/cpack.cmake b/packaging/cpack.cmake index 909603f7..fdc32c97 100644 --- a/packaging/cpack.cmake +++ b/packaging/cpack.cmake @@ -22,10 +22,10 @@ set(CPACK_GENERATOR "ZIP") set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/packaging/cpack-config.cmake") # Debian package settings -math(EXPR PROJECT_VERSION_MAJOR_NEXT "${PROJECT_VERSION_MAJOR}+1") +math(EXPR QTC_COMPAT_MAJOR_NEXT "${QTC_COMPAT_MAJOR}+1") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Christian Rauch ") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES) -set(CPACK_DEBIAN_PACKAGE_DEPENDS "qtcreator (>=${PROJECT_VERSION_MAJOR}), qtcreator (<<${PROJECT_VERSION_MAJOR_NEXT})") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "qtcreator (>=${QTC_COMPAT_MAJOR}), qtcreator (<<${QTC_COMPAT_MAJOR_NEXT})") set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON) include(CPack)