Submodule tries to find a package which is not installed but rather another submodule

197 Views Asked by At

I'm trying to configure a CMake project which uses the git submodule https://github.com/hungpham2511/toppra. That submodule requires the Eigen3 library to work, so in its CMakeLists.txt there is find_package (Eigen3 REQUIRED).

I could simply install the Eigen3 library and CMake would find it (I tried this, it worked). However, my CMake project should not depend on any preinstalled libraries. Moreover, installing Eigen3 makes little sense, since it is a header-only library.

My goal is to include Eigen3 as another submodule and let toppra know where to find it.

I tried to provide Eigen3_DIR directly to toppra's CMakeLists.txt:

set (Eigen3_DIR "${PROJECT_SOURCE_DIR}/eigen" CACHE STRING)

I also tried:

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/eigen")
list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/eigen")

But CMake keeps telling:

1> [CMake] CMake Error at toppra/cpp/CMakeLists.txt:38 (find_package):
1> [CMake]   By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
1> [CMake]   asked CMake to find a package configuration file provided by "Eigen3", but
1> [CMake]   CMake did not find one.
1> [CMake] 
1> [CMake]   Could not find a package configuration file provided by "Eigen3" with any
1> [CMake]   of the following names:
1> [CMake] 
1> [CMake]     Eigen3Config.cmake
1> [CMake]     eigen3-config.cmake
1> [CMake] 
1> [CMake]   Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
1> [CMake]   "Eigen3_DIR" to a directory containing one of the above files.  If "Eigen3"
1> [CMake]   provides a separate development package or SDK, be sure it has been
1> [CMake]   installed.

However, there is nothing like FindEigen3.cmake in the Eigen3 library, unless - and this is important - Eigen3 is installed on the system. In that case, FindEigen3.cmake is created and put in the installation directory of the Eigen3 library.

0

There are 0 best solutions below