aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/cmake/target_links.jinja
blob: ce082a704fec5b70a1eceda23a1d3ffeb5176339 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{%- set interfaces = [] -%}
{%- set publics = [] -%}
{%- set privates = [] -%}
{%- set allocators = [] -%}
{%- set add_interfaces = current_target.link|map(attribute='interfaces')|sum -%}
{%- if add_interfaces|length -%}
{%-     set interfaces = interfaces + add_interfaces -%}
{%- endif -%}
{%- if current_target.is_fake_module -%}
{%-     set add_interfaces = current_target.link|map(attribute='publics')|sum -%}
{%-     if add_interfaces|length -%}
{%-         set interfaces = interfaces + add_interfaces -%}
{%-     endif -%}
{%- else -%}
{%-     set add_publics = current_target.link|map(attribute='publics')|sum -%}
{%-     if add_publics|length -%}
{%-         set publics = publics + add_publics -%}
{%-     endif -%}
{%-     if (current_target.macro == "add_global_library_for") and (target.link|length)  -%}
{%-         set add_publics = target.link|map(attribute='publics')|sum -%}
{%-         if add_publics|length -%}
{%-             set publics = publics + add_publics -%}
{%-         endif -%}
{%-     endif -%}
{%-     set add_privates = current_target.link|map(attribute='privates')|sum -%}
{%-     if add_privates|length -%}
{%-         set privates = privates + add_privates -%}
{%-     endif -%}
{%- endif -%}
{%- if (current_target.allocators is defined) and (current_target.allocators|length) -%}
{%-     if (macro == "add_executable") or (macro == "add_library" and ("SHARED" in macro_args)) -%}
{#-         support allocators -#}
{%-         set allocators = allocators + current_target.allocators|sum -%}
{%-     else -%}
{#-         not supported allocators -#}
{%-         if current_target.is_fake_module -%}
{%-             set interfaces = interfaces + current_target.allocators|sum -%}
{%-         else  -%}
{%-             set publics = publics + current_target.allocators|sum -%}
{%-         endif -%}
{%-     endif -%}
{%- endif -%}

{%- if interfaces|length %}
target_link_libraries({{ name }} INTERFACE
{%-     for interface in interfaces %}
  {{ interface }}
{%-     endfor %}
)
{%  endif -%}

{%- if publics|length %}
target_link_libraries({{ name }} PUBLIC
{%-     for public in publics %}
  {{ public }}
{%-     endfor %}
)
{%  endif -%}

{%- if privates|length %}
target_link_libraries({{ name }} PRIVATE
{%-     for private in privates %}
  {{ private }}
{%-     endfor %}
)
{%  endif -%}

{%- if allocators|length %}
target_allocator({{ name }}
{%-     for allocator in allocators %}
  {{ allocator }}
{%-     endfor %}
)
{%  endif -%}