Skip to content

cmake: Remove REQUIRED from find_dependency() call in package configuration#261

Merged
ethanmusser merged 3 commits intomasterfrom
ethanmusser/245-find-dependency-no-required
Jan 26, 2026
Merged

cmake: Remove REQUIRED from find_dependency() call in package configuration#261
ethanmusser merged 3 commits intomasterfrom
ethanmusser/245-find-dependency-no-required

Conversation

@ethanmusser
Copy link
Contributor

Resolves #245.

@ethanmusser ethanmusser self-assigned this Dec 22, 2025
@ethanmusser ethanmusser added the bug Something isn't working label Dec 22, 2025
@ethanmusser ethanmusser changed the title Remove REQUIRED from find_dependency() call in package configuration cmake: Remove REQUIRED from find_dependency() call in package configuration Jan 5, 2026
find_dependency(MultiSenseWire)
if (@BUILD_JSON_SERIALIZATION@)
find_dependency(nlohmann_json 3.9 REQUIRED)
find_dependency(nlohmann_json 3.9)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the required flag here? I figured if the user wanted to build serialization, they should know if they are missing the associated dependencies

Copy link
Contributor Author

@ethanmusser ethanmusser Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a misuse of the find_dependency() macro. The REQUIRED flag is automatically forwarded from the corresponding find_package() call made by the user in their CMake.

From the CMake docs:

The find_dependency() macro wraps a find_package() call for a package dependency:

find_dependency( [...])

It is designed to be used in a Package Configuration File (Config.cmake). find_dependency forwards the correct parameters for QUIET and REQUIRED which were passed to the original find_package() call.

@ethanmusser ethanmusser merged commit 5d14eb6 into master Jan 26, 2026
7 checks passed
@ethanmusser ethanmusser deleted the ethanmusser/245-find-dependency-no-required branch January 26, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

find_dependency() calls should not use QUIET/REQUIRED

2 participants

Comments