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

Call two times find_package to detect bugs related to double calls #6

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

traversaro
Copy link
Collaborator

It may sometimes happen that:

find_package(pkg REQUIRED)

works, but:

find_package(pkg REQUIRED)
find_package(pkg REQUIRED)

fails. See for example ami-iit/biomechanical-analysis-framework#26, or another common case is forgetting to add a if(TARGET targetname) before a call to add_library(targetname IMPORTED). To catch this problems, this PR modifies cmake-package-check to call find_package(pkg) two times when it checks if pkg is available.

If this behavior needs to be disabled, it can be disabled with the --disable-double-find option.

@traversaro
Copy link
Collaborator Author

Merging so we can use this in ami-iit/bipedal-locomotion-framework#827, feel free to comment also post-merge.

@traversaro traversaro merged commit 35bf54b into main Mar 29, 2024
@davidegorbani
Copy link

Cool! Thank you @traversaro!

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