Skip to content

Make the project version one source of truth - #561

Merged
paceholder merged 1 commit into
masterfrom
add-project-version
Nov 29, 2026
Merged

paceholder merged 1 commit into
masterfrom
add-project-version

Conversation

@paceholder

@paceholder paceholder commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

The library had no version in its sources. The only version was the git tag, so a copy without .git (a zip download, vendored files) could not tell its version. docs/conf.py still said release = '3.0'. There was also no way to ask for a version with find_package or #if.

The version is now written once, in project() of CMakeLists.txt. Everything else comes from it:

  • project(QtNodesLibrary VERSION 3.2.1 LANGUAGES CXX).
  • QtNodesConfigVersion.cmake with SameMajorVersion. find_package(QtNodes 3.1) accepts 3.2.1. find_package(QtNodes 4.0) rejects it.
  • VERSION and SOVERSION on the target.
  • QtNodes/Version defines QTNODES_VERSION_MAJOR, _MINOR, _PATCH, QTNODES_VERSION_STR, QTNODES_VERSION_CHECK(a, b, c) and QTNODES_VERSION. It is generated into the build directory and installed.
  • docs/conf.py and Doxygen take the version from CMakeLists.txt.

CITATION.cff cannot be generated, because GitHub reads the committed file.

  • CITATION.cff gives GitHub a "Cite this repository" button. The README points to it and no longer names a version.
  • cmake/CheckVersion.cmake compares CITATION.cff with project(). CTest runs it, so CI fails a pull request that changes only one of them.

To release: set the new version in project() and CITATION.cff, then run cmake -P cmake/Tag.cmake and push the tag. The script creates the annotated tag from project(). It refuses a version that is not higher than every local and remote tag, and does not push. AGENTS.md and the README ("Releasing") describe this. docs/getting-started/installation.rst shows how to use the version.

The commit also updates the copyright years to 2026: LICENSE.rst and the README citation say 2013-2026, and docs/conf.py says 2026.

Shared builds now get SOVERSION equal to the major version. On Linux the library file becomes libQtNodes.so.3 with a libQtNodes.so link. Static and Windows builds are not affected.

Testing

  • Qt version tested: Qt 6.12.0, macOS arm64 (Apple Clang), offscreen platform
  • Existing tests still pass
  • Added tests for new functionality: TestVersion.cpp for the macros, and the CTest test version_is_the_same_everywhere
  • Checked by hand: cmake --install, then find_package(QtNodes 3.1 REQUIRED) finds 3.2.1 and find_package(QtNodes 4.0 REQUIRED) reports an incompatible version. CheckVersion.cmake fails for a wrong CITATION.cff version. Tag.cmake was run in a throwaway clone with a separate bare remote: it refuses the same version, a lower version, a dirty tree, a higher tag that exists only on the remote and an unknown remote, and creates an annotated tag for a higher version.
  • Not tested: Qt 5, Windows, Linux, building the Sphinx docs, the "Cite this repository" button (it shows only on the default branch).

Breaking changes?

No.

Related issue

Part of the release housekeeping. Found while answering #464, where the reporter could not tell which version he had.

@paceholder paceholder changed the title Declare the project version in CMake and generate a version header Make the project version one source of truth Nov 29, 2026
@paceholder
paceholder force-pushed the add-project-version branch 3 times, most recently from 9c27176 to 60fc9b9 Compare November 29, 2026 16:03
Also update the copyright years to 2026.
@paceholder
paceholder merged commit 8f8a963 into master Nov 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant