Changeset View
Standalone View
CMakeLists.txt
Show All 25 Lines | |||||
26 | include(CMakePackageConfigHelpers) | 26 | include(CMakePackageConfigHelpers) | ||
27 | include(FeatureSummary) | 27 | include(FeatureSummary) | ||
28 | include(WriteBasicConfigVersionFile) | 28 | include(WriteBasicConfigVersionFile) | ||
29 | include(CheckFunctionExists) | 29 | include(CheckFunctionExists) | ||
30 | 30 | | |||
31 | include(KDEInstallDirs) | 31 | include(KDEInstallDirs) | ||
32 | include(KDECMakeSettings) | 32 | include(KDECMakeSettings) | ||
33 | 33 | | |||
34 | include(GetGitRevisionDescription) | ||||
35 | | ||||
34 | set(QT_MIN_VERSION "5.5.0") | 36 | set(QT_MIN_VERSION "5.5.0") | ||
35 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets) | 37 | find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Widgets Concurrent Quick QuickWidgets) | ||
36 | if(BUILD_TESTING) | 38 | if(BUILD_TESTING) | ||
37 | find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) | 39 | find_package(Qt5Test ${QT_MIN_VERSION} CONFIG REQUIRED) | ||
38 | endif() | 40 | endif() | ||
39 | set(KF5_DEP_VERSION "5.15.0") # we need KCrash::initialize | 41 | set(KF5_DEP_VERSION "5.15.0") # we need KCrash::initialize | ||
40 | find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS | 42 | find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS | ||
41 | Config | 43 | Config | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 116 | if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug" | |||
116 | set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) | 118 | set(COMPILER_OPTIMIZATIONS_DISABLED TRUE) | ||
117 | else() | 119 | else() | ||
118 | set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) | 120 | set(COMPILER_OPTIMIZATIONS_DISABLED FALSE) | ||
119 | endif() | 121 | endif() | ||
120 | 122 | | |||
121 | # create config-kdevelop.h | 123 | # create config-kdevelop.h | ||
122 | configure_file(config-kdevelop.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevelop.h) | 124 | configure_file(config-kdevelop.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevelop.h) | ||
123 | 125 | | |||
126 | # create kdevelop_fullversion.h | ||||
127 | set(KDevelop_FULL_VERSION "${KDevelop_VERSION_MAJOR}.${KDevelop_VERSION_MINOR}.${KDevelop_VERSION_PATCH}") | ||||
128 | git_describe(GIT_FULL_VERSION "--tags") | ||||
129 | if(GIT_FULL_VERSION) | ||||
130 | # development build, i.e. from a git working copy. | ||||
131 | # Get the current commit version using `git describe` and | ||||
132 | # strip the leading v plus the part that matches the version | ||||
133 | # declared in the project definition above. | ||||
kfunk: Please just *amend* the version as specified by CMake (that is, re-use VERSION_MAJOR… | |||||
We're not overwriting anything, we're adding an additional full version string. That's not unheard of, this is exactly what's done in Apple's Info.plist files. A "numeric" version for use in code, and a human-readable string that is to be presented to users. I can achieve the same thing the way Krita does things, but that's more complicated (cf. the script I used in the initial release). Sven pointed out that we cannot change VERSION_PATCH because that variable is used by dependent code. Whatever approach I will use I find it crucial that the output from git describe is used. Git hashes are random, so using only them will not allow checking at a glance which of two versions is older or newer (and that's part of what I want to achieve with this patch). rjvbb: We're not overwriting anything, we're adding an additional full version string. That's not… | |||||
You're basically overwriting/invalidating the major.minor.patch version which was previously shown in the About dialog as set by CMake.
It's not more complicated. Please forget about Krita again, it probably only confuses you. And where did I talk about changing VERSION_PATCH? set(KDevelop_FULLVERSION_STRING "${KDEVELOP_VERSION_STRING} (git ${SHA1}") doesn't "change" VERSION_PATCH.
Okay, then please use: That'll show e.g. '5.1.2' twice, but that doesn't harm. kfunk: > We're not overwriting anything, we're adding an additional full version string. That's not… | |||||
I interpreted re-use VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH to suggest that the fuller version should be obtained from them directly. I'll play with string replace, it should be possible to remove ${MAJOR}.${MINOR}.${PATCH} from the git describe return. That way the full version won't show 5.x.y twice if the version from the CMake version agrees with the current tag. Duplicate may not harm but avoiding them is more elegant, don't you think? rjvbb: I interpreted `re-use VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH` to suggest that the fuller… | |||||
134 | string(REPLACE "v${KDevelop_FULL_VERSION}" "" COMMIT_VERSION "${GIT_FULL_VERSION}") | ||||
kfunk: Print this in a more human-readable way, i.e. `Setting KDevelop version to: ...` | |||||
135 | if(NOT ${COMMIT_VERSION} MATCHES ${GIT_FULL_VERSION}) | ||||
136 | # `git describe` agrees with KDevelop_VERSION_STRING; | ||||
137 | # make an atomic version string by appending the additional info | ||||
138 | string(APPEND KDevelop_FULL_VERSION ${COMMIT_VERSION}) | ||||
139 | else() | ||||
140 | # `git describe` provides a seemingly unrelated version string; | ||||
141 | # append it in parentheses. | ||||
142 | string(APPEND KDevelop_FULL_VERSION " (${GIT_FULL_VERSION})") | ||||
143 | endif() | ||||
144 | message(STATUS "Setting KDevelop version to: ${KDevelop_FULL_VERSION}") | ||||
145 | endif() | ||||
146 | configure_file(kdevelop_fullversion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdevelop_fullversion.h) | ||||
147 | | ||||
124 | add_subdirectory(kdevplatform) | 148 | add_subdirectory(kdevplatform) | ||
125 | add_subdirectory(plugins) | 149 | add_subdirectory(plugins) | ||
126 | 150 | | |||
127 | add_subdirectory(pics) | 151 | add_subdirectory(pics) | ||
128 | add_subdirectory(app) | 152 | add_subdirectory(app) | ||
129 | add_subdirectory(app_templates) | 153 | add_subdirectory(app_templates) | ||
130 | add_subdirectory(file_templates) | 154 | add_subdirectory(file_templates) | ||
131 | add_subdirectory(shortcuts) | 155 | add_subdirectory(shortcuts) | ||
Show All 34 Lines |
Please just *amend* the version as specified by CMake (that is, re-use VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH). We don't want to fully overwrite the things set in CMakeLists.txt.
Something along:
set(KDevelop_FULLVERSION_STRING "${KDEVELOP_VERSION_STRING} (git ${SHA1}")
Please check what Krita does in their CMakeLists.txt, I'd like something similar.
FWIW, they use this to get the SHA1:
get_git_head_revision(GIT_REFSPEC GIT_SHA1)