I’m working on a C++ project where I’m already using the Eigen library.
I now want to add library that will allow me to build a surface mesh. I thought about CGAL but it seems to be too heavy and complex for what I need. So I found Polygon Mesh Processing Library or PMP, that will probably do the job just fine.
The problem with the PMP is that it already depends on Eigen (see here).
So when I changed my root CMakeLists.txt
to:
# Add Eigen using CPM
CPMAddPackage(
NAME Eigen
GITLAB_REPOSITORY libeigen/eigen
GIT_TAG 3.4
OPTIONS
"EIGEN_BUILD_DOC OFF" # Do not build documentation
"EIGEN_BUILD_PKGCONFIG OFF" # Optional, disables pkg-config
"BUILD_TESTING OFF" # Disable building and running tests
)
# Add PMP library using CPM
CPMAddPackage(
NAME PMP
GITHUB_REPOSITORY pmp-library/pmp-library
GIT_TAG 3.0.0 # Specify the version you need, or leave it out for the latest
)
I got an error
CMake Error at cmake-build-debug/_deps/pmp-src/examples/CMakeLists.txt:16 (add_executable):
add_executable cannot create target "eigen" because another target with the
same name already exists. The existing target is an interface library
created in source directory.
See documentation for policy CMP0002 for more details.
I’m obviously no CMake expert. Is there a solution to this? Can I convince PMP to use my instance of Eigen? Do I have to find a different meshing library, one independant of Eigen?
Or better said, what can I do?