Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Windows and Eigen #692

Closed
PNeigel opened this issue Oct 4, 2021 · 3 comments
Closed

Building on Windows and Eigen #692

PNeigel opened this issue Oct 4, 2021 · 3 comments

Comments

@PNeigel
Copy link

PNeigel commented Oct 4, 2021

Maybe related to #574, but didn't help me.

I cannot configure CMake on Windows because of Eigen. First problem, it is not found, which is understandable since it's a header only library. These two CMakeLists need Eigen3

find_package (Eigen3 REQUIRED CONFIG QUIET)

find_package (Eigen3 REQUIRED CONFIG QUIET)

First problem here is that the CONFIG parameter makes CMake look for Eigen3Config.cmake or eigen3-config.cmake, which doesn't exist in the eigen3 unpacked source.

If the CONFIG parameter is changed to MODULE then find_package would invoke a FindEigen3.cmake, except it doesn't exist. If I rename FindEigen.cmake into FindEigen3.cmake, then the script is used and (in accordance to #574) the EIGEN_INCLUDE_DIR is actually found and Eigen_FIND_VERSION is correctly set (in my case to 3.4.90), but CMake now complains that

Found package configuration file:

  C:/path/deps/Pangolin/build/PangolinConfig.cmake

but it set Pangolin_FOUND to FALSE so package "Pangolin" is considered to
be NOT FOUND.  Reason given by package:

Pangolin could not be found because dependency Eigen3 could not be found.

If I then manually just add a variable Eigen3_FOUND=1, then it configures, but actually generating the build files gives me a ton of errors like

CMake Error at tools/ModelViewer/CMakeLists.txt:5 (add_executable):
  Target "ModelViewer" links to target "Eigen3::Eigen" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at tools/ModelViewer/CMakeLists.txt:5 (add_executable):
  Target "ModelViewer" links to target "Eigen3::Eigen" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:88 (add_library):
  Target "pango_opengl" links to target "Eigen3::Eigen" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

That's where I'm currently stuck.

@PNeigel
Copy link
Author

PNeigel commented Oct 5, 2021

Okay I resolved it by... actually running CMake on Eigen 🤦‍♂️. The Eigen webpage bamboozled me with the following:

We use the CMake build system, but only to build the documentation and unit-tests, and to automate installation. If you just want to use Eigen, you can use the header files right away. There is no binary library to link to, and no configured header file. Eigen is a pure template library defined in the headers.

so I thought it's optional, but it creates the needed Eigen3Config.cmake for

find_package (Eigen3 REQUIRED CONFIG QUIET)

and
find_package (Eigen3 REQUIRED CONFIG QUIET)

@PNeigel PNeigel closed this as completed Oct 6, 2021
@stevenlovegrove
Copy link
Owner

Glad you solved this because I looked at this yesterday and wasn't sure what to suggest!

@dorioliu
Copy link

dorioliu commented Feb 8, 2022

@PNeigel Hello, pNeigel, excuse me, I saw you solve the cmake issue of Eigen when compiling Pangolin on Windows. What is meaning of " running cmake on Eigen" in your answer, did you mean using Cmake-gui to compile Eigen and then generated Eigen3Config.cmake? Thanks, I also met the same question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants