In Eigen library's official cmake doc, it requires the line target_link_libraries (example Eigen3::Eigen)
. I have tried removing that line, but then the compilation would fail with "Eigen not found".
This directly contradicts the discussion in another StackOverflow question: Using Eigen Lib in my Cmake project?
I don't understand why Eigen would need target_link_libraries
even though it's a template-only library? Just like the above StackOverflow question, I'd assume I only have to include the Eigen headers (include_directories()
) and it should work out of the box. It doesn't.