Refactor QtADS Version To Auto-Generate ads_version.h - #858
Conversation
|
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. |
|
if this pr is approved, then i believe this issue will be resolved. |
bfa13d0 to
e3afe95
Compare
|
What is the disadvantage of defining the library version in CMake: CMakeLists.txtproject(MyLibrary VERSION 1.4.0 LANGUAGES CXX) configure_file( |
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
e3afe95 to
51cacac
Compare
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