[graphics/skanlite] /: Be a tiny bit more lenient with KSaneWidgets versions

Heiko Becker <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 59b5b89ddff5b4dde0866b061e34fb8b9f4984a9 by Heiko Becker.
Committed on 13/08/2026 at 19:10.
Pushed by heikobecker into branch 'master'.

Be a tiny bit more lenient with KSaneWidgets versions

The code comment also contains the motivation, but I add here that
it's an issue with CI I ran into when updating Gear versions after [1].
There was no longer a build of libksane with the new version and thus
skanlite failed to build.

[1] https://invent.kde.org/sysadmin/release-tools/-/merge_requests/73

M  +8    -1    CMakeLists.txt

https://invent.kde.org/graphics/skanlite/-/commit/59b5b89ddff5b4dde0866b061e34fb8b9f4984a9

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7799755..5affeda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,14 @@ set_package_properties(KF6DocTools PROPERTIES DESCRIPTION
     TYPE OPTIONAL
 )
 
-find_package(KSaneWidgets6 "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}" REQUIRED)
+# The intention here is to depend on a release from at least the same release
+# branch and to accomodate the jump from a RC version to .0 (eg. 26.07.90 to
+# 26.08.0), where we shouldn't really add breaking changes anyway.
+math(EXPR KSANEWIDGETS_RELEASE_BRANCH_VERSION "${RELEASE_SERVICE_VERSION_MINOR} - (${RELEASE_SERVICE_VERSION_MINOR} -3) % 4")
+if(KSANEWIDGETS_RELEASE_BRANCH_VERSION LESS "10")
+    string(PREPEND KSANEWIDGETS_RELEASE_BRANCH_VERSION "0") # pad with 0
+endif()
+find_package(KSaneWidgets6 "${RELEASE_SERVICE_VERSION_MAJOR}.${KSANEWIDGETS_RELEASE_BRANCH_VERSION}" REQUIRED)
 
 ecm_set_disabled_deprecation_versions(QT 6.7.2
     KF 6.7.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.