Skip to content

Refactor QtADS Version To Auto-Generate ads_version.h - #858

Open
Deception666 wants to merge 1 commit into
githubuser0xFFFF:masterfrom
Deception666:refactor-ads-version-for-cmake
Open

Refactor QtADS Version To Auto-Generate ads_version.h#858
Deception666 wants to merge 1 commit into
githubuser0xFFFF:masterfrom
Deception666:refactor-ads-version-for-cmake

Conversation

@Deception666

@Deception666 Deception666 commented Jul 23, 2026

Copy link
Copy Markdown
  • the commit simplifies ads version management by making the main cmake
    project of ads the single source of truth for the library version; it
    removes the dependency of git or the ADS_VERSION variable during the
    cmake configuration process. this makes builds more reliable for
    source archives, package maintainers and managers, shallow clones,
    etc. this commit will auto-generate ads_version.h with defined
    variables that represent the current version associated to the qtads
    cmake project command. by providing ads_version.h, downstream
    projects have the ability to perform compile-time feature checks.
    ads_version.h mimics qt's version information macros.

  • Versioning.cmake was updated to remove the automatic git tag
    extraction when including said cmake file. in its place, a new
    function to be called by the qt ads library cmake file to
    auto-generate the ads_version.h file. this file contains the current
    version information as defined by the main cmake file's project command.
    the ads_version.h file is placed next to ads_globals.h and uese
    ads_version.h.in to generate from.

  • ads_version.h mimics qt's version and version check system.

  • the .gitignore was updated to make sure the auto-generated
    ads_version.h is ignored by git.

  • the main cmake file for ads no longer extracts the version information
    from ADS_VERSION if defined or git tags. the QtADS project call now
    requires the human readable VERSION argument to be supplied. the
    variables that were created are no longer needed. PROJECT_VERSION and
    the PROJECT_* components should all be replaced with QtADS_VERSION or
    QtADS_VERSION_* component. the VERSION_SHORT should just be replaced
    with QtADS_VERSION; VERSION_SONAME should just be replaced with
    QtADS_VERSION_MAJOR.

  • GetGitRevisionDescription cmake module files were removed as they are
    no longer needed in describing the current version of ads.

  • validated

    • Windows 11 - Visual Studio 2022 - CMake 4.3.3 - x86_64
    • Kubuntu 25.10 - GCC 15.2.0 - CMake 3.31.6 - x86_64

@githubuser0xFFFF

Copy link
Copy Markdown
Owner

I do not completely understand the purpose if this pull request. Can you please elaborate?

@Deception666

Copy link
Copy Markdown
Author

I do not completely understand the purpose if this pull request. Can you please elaborate?

this pr simplifies ads version management by making ads_globals.h the single source of truth for the library version. it removes the dependency on git during cmake configuration. this make builds more reliable for source archives, package maintainers and managers, shallow clones, etc.. exposing ADS_VERSION in the public header allows downstream projects the ability to perform compile-time feature checks. by moving the version to the header, this pr will now expose its version information similar to other large c/c++ projects like qt. going forward, each new release of ads will require the ADS_VERSION to be updated, as git tags will no longer determine the ads version.

@Deception666

Copy link
Copy Markdown
Author

if this pr is approved, then i believe this issue will be resolved.

@Deception666
Deception666 force-pushed the refactor-ads-version-for-cmake branch from bfa13d0 to e3afe95 Compare July 24, 2026 04:15
@githubuser0xFFFF

Copy link
Copy Markdown
Owner

What is the disadvantage of defining the library version in CMake:

CMakeLists.txt

project(MyLibrary VERSION 1.4.0 LANGUAGES CXX)

configure_file(
version.h.in
generated/version.h
@only
)

@Deception666

Copy link
Copy Markdown
Author

What is the disadvantage of defining the library version in CMake:

i cannot think of any disadvantages. Qt6, while the same, does something to this same effect. cmake's tutorial even talks about doing it this way. what i can do is create a ads_version.h.in that will configure the build numbers and mimic it off of qt's version check. that would allow the version information to be more readable with something like ADS_VERSION_CHECK(5, 0, 0) and ADS_VERSION would just use that macro.

- the commit simplifies ads version management by making the main cmake
  project of ads the single source of truth for the library version; it
  removes the dependency of git or the ADS_VERSION variable during the
  cmake configuration process.  this makes builds more reliable for
  source archives, package maintainers and managers, shallow clones,
  etc.  this commit will auto-generate ads_version.h with defined
  variables that represent the current version associated to the qtads
  cmake project command.  by providing ads_version.h, downstream
  projects have the ability to perform compile-time feature checks.
  ads_version.h mimics qt's version information macros.

- Versioning.cmake was updated to remove the automatic git tag
  extraction when including said cmake file.  in its place, a new
  function to be called by the qt ads library cmake file to
  auto-generate the ads_version.h file.  this file contains the current
  version information as defined by the main cmake file's project command.
  the ads_version.h file is placed next to ads_globals.h and uese
  ads_version.h.in to generate from.

- ads_version.h mimics qt's version and version check system.

- the .gitignore was updated to make sure the auto-generated
  ads_version.h is ignored by git.

- the main cmake file for ads no longer extracts the version information
  from ADS_VERSION if defined or git tags.  the QtADS project call now
  requires the human readable VERSION argument to be supplied.  the
  variables that were created are no longer needed.  PROJECT_VERSION and
  the PROJECT_* components should all be replaced with QtADS_VERSION or
  QtADS_VERSION_* component.  the VERSION_SHORT should just be replaced
  with QtADS_VERSION; VERSION_SONAME should just be replaced with
  QtADS_VERSION_MAJOR.

- GetGitRevisionDescription cmake module files were removed as they are
  no longer needed in describing the current version of ads.

- validated
  * Windows 11 - Visual Studio 2022 - CMake 4.3.3 - x86_64
  * Kubuntu 25.10 - GCC 15.2.0 - CMake 3.31.6 - x86_64
@Deception666
Deception666 force-pushed the refactor-ads-version-for-cmake branch from e3afe95 to 51cacac Compare July 28, 2026 00:31
@Deception666 Deception666 changed the title Refactor QtADS Version CMake Extraction To ads_globals.h Refactor QtADS Version To Auto-Generate ads_version.h Jul 28, 2026
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.

2 participants