[CMake] Use Eigen2 in CMake based project

Marcus D. Hanwell marcus.hanwell at kitware.com
Mon Jan 24 18:19:23 EST 2011


On Mon, Jan 24, 2011 at 6:15 PM, Stefan Dänzer <stefan.daenzer at gmail.com> wrote:
> Hi all,
> I have searched for the correct way to include the Eigen2 linear algebra
> library in my CMake based project. But doing a search has not brought up a
> suitable result. Has anyone used Eigen2 in their project? A CMake sample
> script including Eigen2 would be most helpful.

We make extensive use of Eigen2 in Avogadro.

http://avogadro.openmolecules.net/

Helpful parts are our FindEigen CMake module,

https://github.com/cryos/avogadro/blob/master/cmake/modules/FindEigen2.cmake

As it is header only you just need to call,

include_directories("${EIGEN2_INCLUDE_DIR}")

to add it to the compiler include path, and you should be able to use
it as expected.

Marcus


More information about the CMake mailing list