Skip to content

fix: stop version.h dropping zero-valued version components - #113

Closed
skilledwolf wants to merge 1 commit into
masterfrom
fix/version-header-macros
Closed

fix: stop version.h dropping zero-valued version components#113
skilledwolf wants to merge 1 commit into
masterfrom
fix/version-header-macros

Conversation

@skilledwolf

@skilledwolf skilledwolf commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

version.h.in declared the version components with cmakedefine, which emits /* #undef NAME */ when the substituted value is false-y. CMake counts 0 as false-y, so any x.y.0 release generates an installed header with that component silently missing. We're at v2.3.4-beta.2, so 2.4.0 would have tripped it.

  • Plain #define for every macro the build unconditionally sets. cmakedefine stays only for ALPS_XML_ALTERNATE_DIR, which the build never sets and parser/xslt_path.C guards with #ifdef.
  • Add ALPS_VERSION_NUMBER / ALPS_VERSION_NUM() for preprocessor version checks, packed like BOOST_VERSION.
  • Drop ALPS_SVN_REVISION (expanded @ALPS_WC_REVISION@, unset since the SVN migration, always #undef) and ALPS_SRCDIR (baked the build machine's source path into an installed header for one line of pconfig output).

Verified by generating the header at 2.4.0 and 2.3.4 and compiling against each. set(ALPS_SRCDIR ...) is left in CMakeLists.txt on purpose — that file is contested by #107/#110/#112, and the follow-up rewrites the block.

Refs #95. Scoped to the two files no other open PR touches, so it can merge independently of the #107#111#112 stack.

@skilledwolf skilledwolf self-assigned this Jul 25, 2026
@skilledwolf
skilledwolf requested review from Ooolab and vws100 July 25, 2026 00:15
version.h.in declared ALPS_VERSION_MAJOR/MINOR/PATCH with cmakedefine,
which emits "/* #undef NAME */" when the substituted value is false-y.
CMake counts 0 as false-y, so any x.y.0 release generated a header with
that component silently missing. 2.4.0 would have tripped it.

Use a plain #define for every macro the build unconditionally sets.
Keep cmakedefine only for ALPS_XML_ALTERNATE_DIR, which the build never
sets and parser/xslt_path.C guards with #ifdef.

Also add ALPS_VERSION_NUMBER/ALPS_VERSION_NUM() for preprocessor version
comparisons (BOOST_VERSION packing), and drop two macros: ALPS_SVN_REVISION,
which expanded a variable unset since the SVN migration and was always
#undef, and ALPS_SRCDIR, which baked the build machine's source path into
an installed header for one line of pconfig output.

Refs #95

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@skilledwolf

Copy link
Copy Markdown
Collaborator Author

Folding this into #114, which single-sources the version from ALPS_VERSION.txt. The commit here is preserved as the first of the two commits there, so nothing is lost.

Rationale: on its own this PR was a 2-file fix with no user-visible change, and the set(ALPS_SRCDIR ...) it orphaned in CMakeLists.txt had to be left dangling for a follow-up. #114 removes that in the same change and pairs the header fix with the version plumbing it belongs to.

Branch fix/version-header-macros left in place for now; safe to delete.

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