Skip to content

Reorganize CMake and minimize configuration for non-top-level builds.

Main changes:

  • Re-arranged main CMakeLists.txt to group target types together
  • Only add install targets if top-level edit: re-enabled to support dependency installations. See comments in the CMakeLists.txt file.
  • Only check for math library + other build settings if we're actually building something
  • Only configure tests and add test build flags if EIGEN_BUILD_TESTING
  • Don't exclude BLAS/LAPACK from all target, so install target will work properly if EIGEN_BUILD_BLAS/EIGEN_BUILD_LAPACK are on
  • Remove clang-format 9 target (we didn't use it and don't need it now with git clang-format)
  • Explicitly add Eigen3::Eigen to lapack/tests instead of relying on adding the cmake include directory globally

This should silence most checks when adding Eigen as a subdirectory to an external project, or when using CMake's FetchContent. Also leads to much faster configuration (from 1min -> 5 seconds on my machine)

Fixes #2740 (closed).

Edited by Antonio Sánchez

Merge request reports

Loading