CMake Install: Fix extra/missing packages #72
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
find_dependency
because it will show up in the link libs of the imported rocky targetfind_dependency
, unless you're building static. If building static, now searching also fornlohmann_json
.ROCKY_HAS_
flags in the Config.cmake.in file, matching GDAL styleREQUIRED
flag on allfind_dependency
. Each one is implicitly required in order to get Rocky linking as an imported target. AddingREQUIRED
causes early exits forfind_package(Rocky)
in cases wherefind_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.