0

I am compiling a cmake file[1] that needs a common library[2]. How do you tell cmake where to find FindXXXX.cmake?

More concretely, cmake runs find_package(Eigen3 REQUIRED) and gets angry because I haven't sent CMAKE_MODULE_PATH or CMAKE_PREFIX_PATH. Given the path/to/FindEigen3.cmake, how should they be set? I have set both of these variables to the full qualified path.

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

[1] The exact file is at https://github.com/lightvector/KataGo/blob/master/cpp/CMakeLists.txt#L298

[2] The exact library is Eigen3, but I suspect the answer does not depend on this fact.

A minimal reproducible example is:

git clone https://github.com/lightvector/KataGo.git
cd KataGo/cpp
cmake . -DUSE_BACKEND=EIGEN
Test
  • 962
  • 9
  • 26
  • Search procedure of config files (Eigen provides a config file, not a Find module file) is explained here: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure. – SpacePotatoes Jul 17 '22 at 07:31
  • But basically you fill `CMAKE_PREFIX_PATH` with install prefix of external libraries. Install prefix means full qualified path of the parent folder of include & lib folders of the installed library (and usually config file is under `lib/cmake/` folder, so CMake is happy). – SpacePotatoes Jul 17 '22 at 07:38

0 Answers0