blob: 5464f05504a4a6e7d4126d0873b750bce5960117 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
{%- macro RenderPackages(target) -%}
{%- set packages = [] -%}
{%- if (target.packages is defined) and (target.packages|length) -%}
{%- set packages = packages + target.packages -%}
{%- endif -%}
{%- if (target.mpackages is defined) and (target.mpackages|length) -%}
{%- if packages|length -%}
{#- Skip duplicating packages -#}
{%- set mpackages = target.mpackages|rejectattr('name', 'in', packages|map(attribute='name')) -%}
{%- if mpackages|length -%}
{%- set packages = packages + mpackages -%}
{%- endif -%}
{%- else -%}
{%- set packages = packages + target.mpackages -%}
{%- endif -%}
{%- endif -%}
{%- if packages|length -%}
{%- for package in packages -%}
find_package({{ package.name }} REQUIRED
{%- if package.components|length %} COMPONENTS
{%- for component in package.components %}
{{ component }}
{% endfor -%}
{%- endif -%}
)
{% endfor -%}
{%- endif -%}
{%- endmacro -%}
{%- if target is defined -%}
{{ RenderPackages(target) }}
{%- endif -%}
{%- if extra_targets is defined -%}
{%- for extra_target in extra_targets -%}
{{ RenderPackages(extra_target) }}
{%- endfor -%}
{%- endif -%}
|