I'm trying to use CMake with VSCode. When I try to add Eigen3 into CMakeLists.txt and rebuild, I get this error:
[cmake] CMake Error at CMakeLists.txt:4 (find_package):
[cmake] Could not find a package configuration file provided by "Eigen3" (requested
[cmake] version 3.3) with any of the following names:
[cmake]
[cmake] Eigen3Config.cmake
[cmake] eigen3-config.cmake
[cmake]
[cmake] Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
[cmake] "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
Here is how my Eigen3_DIR is set. I've also tried setting CMAKE_PREFIX_PATH to the same:
Eigen3_DIR="/mingw64/share/eigen3/cmake"
$ ls /mingw64/share/eigen3/cmake
Eigen3Config.cmake Eigen3ConfigVersion.cmake Eigen3Targets.cmake UseEigen3.cmake
I've also tried setting those environment variables to the include folder where Eigen was installed.
Here's the command VSCode is using:
[main] Building folder: GraphicsEngine
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --version
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -E capabilities
[proc] Executing command: C:\msys64\ucrt64\bin\gcc.exe -v
[main] Configuring project: GraphicsEngine
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\ucrt64\bin\g++.exe -SG:/Documents/Projects/GraphicsEngine -Bg:/Documents/Projects/GraphicsEngine/build -G "MinGW Makefiles"
Here's my CMakeLists.txt:
cmake_minimum_required (VERSION 3.0)
project (graphics_engine)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
add_executable (example Raytracer.cpp)
target_link_libraries (example Eigen3::Eigen)
The package I installed:
https://packages.msys2.org/package/mingw-w64-x86_64-eigen3
Is there something I'm missing or getting wrong?