Skip to content

Find an installed Eigen 3.4 as well as Eigen 5 - #356

Merged
susilehtola merged 1 commit into
masterfrom
eigen3-version-range
Oct 1, 2026
Merged

susilehtola merged 1 commit into
masterfrom
eigen3-version-range

Conversation

@susilehtola

Copy link
Copy Markdown
Owner

find_package(Eigen3 3.4...99) was meant to accept any Eigen >= 3.4, but Eigen 3.4's Eigen3ConfigVersion.cmake declares SameMajorVersion, under which a version range is accepted only if both of its ends have major version 3. Every Eigen 3 was therefore rejected: on RHEL 10 with EPEL's eigen3-devel-3.4.0 the configure reports "Eigen3 >= 3.4 not found" and fetches 5.0.1 over the installed package.

This asks for a bare 3.4 first — which SameMajorVersion reads as any 3.x >= 3.4 — and falls back to the range for Eigen 5, whose ConfigVersion reads a bare 3.4 as [3.4, 3.5). A version-rejected find_package loads no targets, so the second request starts clean.

Checked in a standalone project against a SameMajorVersion 3.4.0 package (generated with write_basic_package_version_file) and Fedora 44's Eigen 5.0.1:

request Eigen 3.4.0 Eigen 5.0.1
3.4...99 (before) rejected found
3.4, then 3.4...99 (this PR) found found

🤖 Generated with Claude Code

https://claude.ai/code/session_01RyAriWLj2QhhGFs6GrWVC3

find_package(Eigen3 3.4...99) was meant to accept any Eigen >= 3.4, but
Eigen 3.4's ConfigVersion declares SameMajorVersion, under which a range
is accepted only if both of its ends have major version 3.  Every Eigen 3
was therefore rejected: on RHEL 10 with EPEL's eigen3-devel 3.4.0 the
configure reported "Eigen3 >= 3.4 not found" and fetched 5.0.1 instead.

Ask for a bare 3.4 first, which SameMajorVersion reads as any 3.x >= 3.4,
and fall back to the range for Eigen 5, whose ConfigVersion reads a bare
3.4 as [3.4, 3.5).  Checked against a SameMajorVersion 3.4.0 package and
Fedora's Eigen 5.0.1: the old request rejects the first, the new one
accepts both.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyAriWLj2QhhGFs6GrWVC3
@susilehtola
susilehtola merged commit ec8fe3f into master Oct 1, 2026
1 check passed
@susilehtola
susilehtola deleted the eigen3-version-range branch October 1, 2026 15:02
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