1

I am attempting to set up eigen with clion and I cannot solve my errors. All solutions I've found online do not work for my case.

I modified the cmake list based on a solution I found on this website Error with Clion/Cmake and Eigen

and I get this error:

CMake Error at CMakeLists.txt:8 (find_package):
Could not find a package configuration file provided by "Eigen 
(requested version 3.3) 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.

No such files exist in the eigen folders. So I had to create a build folder and run the bash command "cmake ../". This created the eigen3config.cmake file. I modified the cmakelists file to the following:

cmake_minimum_required(VERSION 3.9)
project(program)

set(CMAKE_CXX_STANDARD 17)

set(EIGEN_DIR "C:\\headers\\eigen\\build")
include_directories(${EIGEN_DIR})
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
add_executable(program main.cpp)
target_link_libraries(program ${EIGEN_DIR})

And nothing changes. I get the exact same error message as before and the file Eigen3Config.cmake now exists in the build folder.

Denis
  • 11
  • 1
  • 1
    You can remove find_package line. Also remove the target_link_libraries line. Also, if you unzipped Eigen to c:\headers\eigen, then your include directory should be c:\headers\eigen only. Eigen is header only and include_directories should be enough. I don't know how well find_package works in windows. – Mochan Jan 18 '19 at 22:51
  • That did the trick. Thanks a lot! – Denis Jan 19 '19 at 20:07

0 Answers0