fix(build): use pre-built Eigen3 from deps/ instead of bundled 3.3.7

deps_src/eigen contained Eigen 3.3.7 from the ImageMap fork, which
predates the Eigen::all placeholder (requires Eigen 3.4+). libigl in
deps_src uses Eigen::all, causing build failures. Switch to find_package
so the Eigen3::Eigen target resolves to the Eigen 5.0.1 installed by
deps/ CMakeLists via CMAKE_PREFIX_PATH.
This commit is contained in:
thysson2701
2026-07-21 14:30:48 +02:00
parent 5abd88de31
commit 563ade1276

View File

@@ -1,15 +1,13 @@
cmake_minimum_required(VERSION 3.13)
project(eigen)
add_library(eigen INTERFACE)
# Use the pre-built Eigen from deps/ (Eigen3Config.cmake is installed there via CMAKE_PREFIX_PATH).
# The bundled headers in this directory are an older version and must not be used directly,
# as libigl and admesh require Eigen3::Eigen with Eigen 3.4+ features (e.g. Eigen::all).
find_package(Eigen3 REQUIRED NO_MODULE)
target_include_directories(eigen SYSTEM
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
)
# Eigen is header-only, so we only need to specify the include directory
# The headers are in the Eigen/ subdirectory structure
# Alias so that targets linking Eigen3::Eigen also work
add_library(Eigen3::Eigen ALIAS eigen)
# Provide a plain "eigen" alias for any code that links to the unnamespaced target.
if(NOT TARGET eigen)
add_library(eigen INTERFACE)
target_link_libraries(eigen INTERFACE Eigen3::Eigen)
endif()