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

feat: target_find_dependencies with find_package args #257

Merged
merged 5 commits into from
Apr 29, 2024

Conversation

FeignClaims
Copy link
Contributor

Extend target_find_dependencies to support a more complex syntax:

target_find_dependencies(<target_name>
  [ # the old simple mode
    <INTERFACE|PUBLIC|PRIVATE|INTERFACE_CONFIG|PUBLIC_CONFIG|PRIVATE_CONFIG>
    [dependency1...]
  ]...

  [ # the new complex mode
    <INTERFACE|PUBLIC|PRIVATE|INTERFACE_CONFIG|PUBLIC_CONFIG|PRIVATE_CONFIG>
    [PACKAGE <dependency_name> [find_package() argument1...]]...
  ]...
)

This allows users to custom how the package is find_package-ed:

target_find_dependencies(target
  PUBLIC
    PACKAGE Qt6 COMPONENTS Widgets
    PACKAGE fmt CONFIG

  PUBLIC_CONFIG
    range-v3
)

Fix #251

For packages like Qt, users might custom find_package like
`find_package(Qt6 CONFIG REQUIRED COMPONENTS Widgets)`.

This patch supports such a customazation by adding a complex mode for
`target_find_dependencies`. That is,

```cmake
target_find_dependencies(target
  PUBLIC
    PACKAGE Qt6 COMPONENTS Widgets
    PACAKGE Microsoft.GSL QUIET

  PUBLIC
  fmt
  range-v3
)
```
The official `set_property` contains supports the same behaviour when turning on the `APPEND` option.
@aminya aminya merged commit 46081b2 into aminya:main Apr 29, 2024
20 checks passed
@FeignClaims FeignClaims deleted the feature/complex_find_dependencies branch May 6, 2024 06:56
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.

target_find_dependencies with COMPONENT
2 participants