diff --git a/docs/changelog.md b/docs/changelog.md index d752f1fc8a..9c624ef563 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -33,6 +33,9 @@ Internal: Bug fixes: +- Fixed test builds with installed Eigen 5 by improving `Eigen3` CMake package detection. + [#6036](https://github.com/pybind/pybind11/pull/6036) + - Fixed move semantics of `scoped_ostream_redirect` to preserve buffered output and avoid crashes when moved redirects restore stream buffers. [#6033](https://github.com/pybind/pybind11/pull/6033) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d5d597cdff..fc08a9056f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -300,10 +300,17 @@ if(PYBIND11_TEST_FILES_EIGEN_I GREATER -1) else() find_package(Eigen3 3.2.7 QUIET CONFIG) + if(NOT Eigen3_FOUND) + find_package(Eigen3 5 QUIET CONFIG) + endif() + set(EIGEN3_FOUND ${Eigen3_FOUND}) + set(EIGEN3_VERSION ${Eigen3_VERSION}) if(NOT EIGEN3_FOUND) # Couldn't load via target, so fall back to allowing module mode finding, which will pick up # tools/FindEigen3.cmake + # This MODULE-mode fallback is for older Eigen 3 setups; Eigen 5 is expected to be found + # via the CONFIG-mode probes above. find_package(Eigen3 3.2.7 QUIET) endif() endif()