aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/cmake/dir_packages.jinja
blob: d3898bcf10de453a92caa7aeef9c62fcb00a43c5 (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
{%-  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 -%}