1

I am attempting to include the Eigen libraries into my project.

I am using CMake and FetchContent to build the project. I was able to include another library using the same method.

A snippit of my "dependencies.cmake" is included below:

if (NOT TARGET endftk )
           FetchContent_Declare( endftk
           GIT_REPOSITORY https://github.com/njoy/ENDFtk.git
           GIT_TAG origin/develop )
           FetchContent_MakeAvailable( endftk)
endif()

if (NOT TARGET Eigen)
        FetchContent_Declare( Eigen
        GIT_REPOSITORY  https://gitlab.com/libeigen/eigen.git
        GIT_TAG origin/master )
        FetchContent_MakeAvailable( Eigen)
endif()

I link both libraries using:

 target_link_libraries(POLR
               INTERFACE ENDFtk
               INTERFACE eigen )

in my main header file I then include the libraries using:

#include <ENDFtk.hpp>
#include <Eigen>      

I've also tried using the following:

#include <Eigen3>
#include <eigen> 
#include <Eigen.hpp>

All of which fail with the following error message when attempting to make:

fatal error: Eigen: No such file or directory
 

However, I have no such issue including and using the ENDFtk library.

I've looked in my build/_deps folder and I do see Eigen (and ENDFtk) there.

Does anybody know what I need to do in order to get Eigen to include?

I'm using: cmake version 3.22.1 gcc version 11.3.0

Please let me know if there is any crucial information I'm leaving out.

Note: POLR is the name of my project.

Mahmoud Abdelsattar
  • 1,299
  • 1
  • 15
  • 31
mlaza
  • 11
  • 2
  • Should `FetchContent_MakeAvailable( endftk)` be `FetchContent_MakeAvailable( Eigen)`? And in your source code you should write `#include ` etc (`#include ` if you want to include everything). – chtz Jun 28 '22 at 15:36
  • That was a mistake in my question, thank you for catching it. My code does read FetchContent_MakeAvailable( Eigen) I've also tried #include It doesn't seem to find the package at all – mlaza Jun 28 '22 at 16:40
  • Can you provide a [mre]? (Remove everything not related to Eigen then post your complete CMakeLists.txt and main.cpp file) – chtz Jun 28 '22 at 23:22

0 Answers0