Skip to content

Conversation

@aschier
Copy link

@aschier aschier commented Jan 14, 2025

Add exported targets to make it easier to link against geometry-central.

Projects can then simply use

find_package(geometry-central)

to link against it and configure the location using geometry-central_DIR, which will also be automatically detected if geometry-central is installed in $CMAKE_PREFIX_PATH.
I also added the version (from the latest tag) to the CMakeLists.txt so that projects can require a specific version.

The targets should probably be handled by ${GC_DEP_LIBS}, but that causes a mismatch between the eigen and Eigen3::Eigen targets, and I do not want to change too much in your CMakeFiles.txt files. Possibly these dependencies could also be private in case that geometry-central links them statically.

@hollowsunhc
Copy link

Looks similar to what I'm achieving here #176

@aschier
Copy link
Author

aschier commented Jan 15, 2025

I'd happily use your commit when it gets merged. This one is the minimalist version to get it to run.
What do the maintainers think? There is little news on the other pull request as well.

@hollowsunhc
Copy link

hollowsunhc commented Jan 15, 2025

Well I believe I understand. They need to check if it works because I'm barely providing any proof nor tests. Moreover, I've been using Windows to make the changes and test them. I cannot guarantee it works on Linux.

There could also be an issue related to naming and standardization. For example, should a given directory be called "geometrycentral", or "geometry-central"? find_package(geometrycentral) or find_package(geometry-central)? Ultimately, it's up to them to decide what they want. I'm just here providing some logic that worked for me 😄

EDIT: Also, it would be a breaking change, bumping the version to 1. They may not want that now.

@nmwsharp
Copy link
Owner

Hi all, thanks for your effort on this (combining discussion here and in #176 since they both concern similar changes).

I'm happy to merge changes to support exported targets/installation, although I don't know much about setting this up in CMake so it's tough for me to tell what changes are reasonable. Can you point to any places in the CMake docs that suggest this kind of a setup? Or other established projects which you a similar system?

RE versioning, would it be easier if we recorded a version string somewhere in the project rather than attempting to read it from a git tag? I am used to having to do this in other project, and it's not the end of the world to need to bump the version in two places.

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

Successfully merging this pull request may close these issues.

3 participants