Skip to content

Commit

Permalink
set major versions via variables for Qt Creator version
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch authored and christian-rauch committed Dec 3, 2024
1 parent b47adb3 commit af866d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions packaging/cpack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>")
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)

0 comments on commit af866d7

Please sign in to comment.