Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having trouble adding autodiff and Eigen to a project #301

Open
EmmanuelMess opened this issue Sep 16, 2023 · 1 comment
Open

Having trouble adding autodiff and Eigen to a project #301

EmmanuelMess opened this issue Sep 16, 2023 · 1 comment

Comments

@EmmanuelMess
Copy link

EmmanuelMess commented Sep 16, 2023

Turns out there is a (sort of) library "autodiff" inside Eigen 3.4.0.

I added Eigen and autodiff like this:

 cpmaddpackage("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip")
 cpmaddpackage("gh:autodiff/autodiff@1.0.3")

It returns the error:

CMake Error at cmake-build-debug-gcc-10/_deps/tools-src/cmake/SystemLink.cmake:65 (target_link_libraries):
  Target "autodiff" of type UTILITY may not be linked into another target.
  One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
  executables with the ENABLE_EXPORTS property set.

The problem is that the linked library is eigen's autodiff (inside unsupported/test), not autodiff/autodiff.

@EmmanuelMess
Copy link
Author

Here is a workaround:

set(EIGEN_BUILD_DOC OFF)
set(BUILD_TESTING OFF) # This removes the tests and makes autodiff test not collide with autodiff/autodiff
set(EIGEN_BUILD_PKGCONFIG OFF)
cpmaddpackage("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip")

cpmaddpackage("gh:autodiff/autodiff@1.0.3")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant