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

CMake Install: Fix extra/missing packages #72

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

emminizer
Copy link
Contributor

Clean-up pass on the CMake install. I noticed when integrating Rocky into my own project that the number of projects being searched for didn't seem right. I did a deep dive to clean this up:

  • Setting the ROCKY_STATIC variable on the Rocky library instead of global, so that when you do a make install it carries over to the imported target correctly.
  • Spacing normalization on open parens, to match rest of the file
  • Anything public, now gets an unconditional find_dependency because it will show up in the link libs of the imported rocky target
  • Anything private does not require a find_dependency, unless you're building static. If building static, now searching also for nlohmann_json.
  • Now respecting various ROCKY_HAS_ flags in the Config.cmake.in file, matching GDAL style
  • Removed the REQUIRED flag on all find_dependency. Each one is implicitly required in order to get Rocky linking as an imported target. Adding REQUIRED causes early exits for find_package(Rocky) in cases where find_package() should be handling already in a normalized way.

Side note, the CMake configuration for the project is awesome, it has been very easy to work with compared to some of the libraries we use. Having find_package "just work" is really useful.

I tested this on Windows MSVC 2022 with a standalone project importing Rocky and linking it to an executable. Rocky was built not using vcpkg. I did not yet test Linux, still working on getting all the dependencies built there but I'd expect this to work identically there.

@gwaldron gwaldron merged commit 482f6c4 into pelicanmapping:main Jan 16, 2025
1 check passed
@gwaldron
Copy link
Member

Thanks Dan :)

@emminizer emminizer deleted the cmake-clean-depends branch January 22, 2025 13:04
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.

2 participants