0

I'm trying to install a library which relies on Eigen library. The error I'm getting in Windows 10 using Cmake 3.23.0-rc2. I'm getting this

  CMake Error at CMakeLists.txt:25 (FIND_PACKAGE):
  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.

There are no Eigen3Config.cmake eigen3-config.cmake in Eigen library I'm using version 3.2.4. Since this is a header-only library, I didn't do any configuration in Windows 10. Some people suggest to add this line

list(APPEND CMAKE_MODULE_PATH "<path to eigen>/cmake")

But it didn't solve my problem. This is the part in CMakeLists.txt

CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
if(WIN32)
    ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
    FIND_PACKAGE(Eigen3 CONFIG REQUIRED)
    INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
endif()

Adding path to the Eigen folder didn't solve the problem.

CroCo
  • 5,531
  • 9
  • 56
  • 88
  • Eigen 3.2.4 has script [cmake/FindEigen3.cmake](https://gitlab.com/libeigen/eigen/-/blob/3.2.4/cmake/FindEigen3.cmake). So MODULE mode should work when set `CMAKE_MODULE_PATH` variable. But in your code you explicitly tells `find_package` to use CONFIG mode: this is what the paremeter `CONFIG` means. Just remove that parameter. – Tsyvarev Mar 01 '22 at 13:44
  • @Tsyvarev that solved the problem. Thanks. – CroCo Mar 01 '22 at 18:45

0 Answers0