Commit 06482c2
[Fix] Dependencies find_package Eigen error (#23939)
### Description
To fix the CMake configuration error when a dependency brought in via
FetchContent uses find_package(Eigen3 REQUIRED)
Major Changes:
- enable EIGEN_BUILD_CMAKE_PACKAGE
- [optional] rename eigen to Eigen3
### Motivation and Context
Get the following build error when Dependencies use find_package(Eigen3
REQUIRED)
```
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
Could not find a package configuration file provided by "Eigen3" with any
of the following names:
Eigen3Config.cmake
eigen3-config.cmake
Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
provides a separate development package or SDK, be sure it has been
installed.
```
Eigen need enable **EIGEN_BUILD_CMAKE_PACKAGE** when FetchContent for
generate **Eigen3Config.cmake**
https://gitlab.com/libeigen/eigen/-/blob/master/CMakeLists.txt?ref_type=heads#L213
in addition , the eigen‘s project name is "Eigen3" and providing the
cmake configuration file is "Eigen3Config.cmake" :
https://gitlab.com/libeigen/eigen/-/blob/master/CMakeLists.txt?ref_type=heads#L36
https://gitlab.com/libeigen/eigen/-/blob/master/CMakeLists.txt?ref_type=heads#L252
So I think it's best for FetchContent_Declare Name to be consistent with
the project name to avoid potential errors.
Co-authored-by: mingyue <mingyue@xilinx.com>1 parent 47bd046 commit 06482c2
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
0 commit comments