Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mvieth
Copy link
Member

@mvieth mvieth commented Sep 25, 2025

Fixes #6351

@mvieth mvieth added module: cmake changelog: fix Meta-information for changelog generation labels Sep 25, 2025
@mvieth
Copy link
Member Author

mvieth commented Sep 25, 2025

Seems like there is currently not really a way to specify a version range like 3.3...5, Eigen 3.4.0 would not work that way (see e.g. https://gitlab.com/libeigen/eigen/-/issues/2972 ). I guess it is fine for us to drop the version requirement, since Eigen 3.3.0 was released in 2016 so it seems very unlikely that somebody uses an Eigen version older than that.

@sumir0
Copy link
Contributor

sumir0 commented Sep 26, 2025

If I may propose an alternative, have you considered using <PackageName>_FOUND and <PackageName>_VERSION variables after call to find_package(Eigen3 NO_MODULE) instead of find_package(Eigen3 REQUIRED NO_MODULE)? See find_package documentation for details (choose the appropriate version of documentation if needed). Basically, I propose some sort of conditional checking:

find_package(Eigen3 NO_MODULE) # find_package(... QUIET ...) may be used
if (NOT Eigen3_FOUND OR Eigen3_VERSION VERSION_LESS 3.3)
  # handle the condition, for example:
  message(FATAL_ERROR "Eigen3 version>=3.3 is required") # exit with error
  # the message, probably, can be identical to what is generated with REQUIRED option
endif()

@mvieth
Copy link
Member Author

mvieth commented Sep 26, 2025

@sumir0 Thanks for the suggestion. You propose this as a way to enforce the version requirement, right? And the following should work as well?

find_package(Eigen3 REQUIRED NO_MODULE)
if (Eigen3_VERSION VERSION_LESS 3.3)
  message(FATAL_ERROR "Eigen3 version>=3.3 is required, but found ${Eigen3_VERSION}")
endif()

@sumir0
Copy link
Contributor

sumir0 commented Sep 27, 2025

You propose this as a way to enforce the version requirement, right?

Yes, as a way to not allow users to build this library using some versions of a dependency.

And the following should work as well?

find_package(Eigen3 REQUIRED NO_MODULE)
if (Eigen3_VERSION VERSION_LESS 3.3)
  message(FATAL_ERROR "Eigen3 version>=3.3 is required, but found ${Eigen3_VERSION}")
endif()

Yes, it should work. But there is a little downside: in the case Eigen3 is not found, the user will get a standard CMake fatal error without version requirement. In some hypothetical scenario the user might install version<3.3 and only then get a version error. Therefore, I will prefer find_package without REQUIRED option. But the choice is not up to me. By the way, I, personally, like to have additional verbosity in this case with but found ${Eigen3_VERSION}, nicely done!

P.S. Actually I do not really know if all versions>=3.3 are supported or all versions<3.3 are not supported, I made an assumption based on the source code. But it can be checked later, if needed.

@mvieth
Copy link
Member Author

mvieth commented Sep 27, 2025

Yes, it should work. But there is a little downside: in the case Eigen3 is not found, the user will get a standard CMake fatal error without version requirement. In some hypothetical scenario the user might install version<3.3 and only then get a version error. Therefore, I will prefer find_package without REQUIRED option. But the choice is not up to me. By the way, I, personally, like to have additional verbosity in this case with but found ${Eigen3_VERSION}, nicely done!

I understand your point, but that scenario does not seem very likely, and I would rather just use the REQUIRED option for simplicity.
Anyway, thanks again for your suggestion.

@mvieth mvieth merged commit 2d6929b into PointCloudLibrary:master Sep 27, 2025
13 checks passed
@mvieth mvieth deleted the eigen-5.0.0 branch September 27, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation module: cmake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cmake/Eigen3] Find_package incompatible with Eigen 5.0.0
3 participants