aboutsummaryrefslogtreecommitdiffstats
path: root/build/export_generators/cmake/target_commands.jinja
blob: ebc1ef6c13efad52369607f220d828a00a003a30 (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
75
76
77
78
79
80
81
82
83
{%- if current_target.target_commands|length -%}
{%-     for target_command in current_target.target_commands %}
{{ target_command.macro }}(
{%-         if target_command.args|length -%}
{%-             for arg in target_command.args %}
  {{ arg }}
{%-             endfor -%}
{%-         endif -%}
{%-         if target_command.args_escaped|length %}
  "
{%-             for arg_escaped in target_command.args_escaped -%}
{{ arg_escaped|replace('\\', '\\\\')|replace('"', '\\"')|replace(';', '\\;') }}
{%-             if not loop.last -%};{%- endif -%}
{%-             endfor -%}
"
{%-         endif %}
)
{%      endfor -%}
{%- endif -%}

{%- if current_target.custom_runs|length -%}
{%-     for custom_run in current_target.custom_runs %}
{%-         set first_arg = custom_run.command|first %}
{%-         set tail_args = custom_run.command|slice(1, custom_run.command|length - 1) %}
{%-         if (first_arg == "run_antlr") or (first_arg == "run_antlr4") %}
{{ first_arg }}(
{%-             if custom_run.outputs|length %}
  OUTPUT
{%-                 for output in custom_run.outputs %}
  {{ output }}
{%-                 endfor -%}
{%-             endif %}
{%-             if (custom_run.cwd is defined) and (custom_run.cwd != "") %}
  WORKING_DIRECTORY
  {{ custom_run.cwd }}
{%-             endif -%}
{%-             if tail_args|length %}
  ANTLR_ARGS
{%-                 for tail_arg in tail_args %}
  {{ tail_arg }}
{%-                 endfor -%}
{%-             endif -%}
)
{%-         else %}
add_custom_command(
{%-             if custom_run.outputs|length %}
  OUTPUT
{%-                 for output in custom_run.outputs %}
  {{ output }}
{%-                 endfor -%}
{%-             endif -%}
{%-             if custom_run.depends|length %}
  DEPENDS
{%-                 for depend in custom_run.depends %}
  {{ depend }}
{%-                 endfor -%}
{%-             endif -%}
{%-             if (custom_run.cwd is defined ) and (custom_run.cwd != "") %}
  WORKING_DIRECTORY
  {{ custom_run.cwd }}
{%-             endif -%}
{%-             if custom_run.command|length %}
  COMMAND
{%-                 if custom_run.env|length %}
  ${CMAKE_COMMAND}
  -E
  env
{%-                     for env in custom_run.env %}
  {{ env|replace('\\', '\\\\')|replace('"', '\\"')|replace(';', '\\;') }}
{%-                         if not loop.last -%};{%- endif -%}
{%-                     endfor -%}
{%-                 endif -%}
{%-                 for arg in custom_run.command -%}
{%-                     if loop.first and arg == "python3" -%}
{%-                         set arg = "Python3::Interpreter" -%}
{%-                     endif %}
  {{ arg }}
{%-                 endfor -%}
{%-             endif %}
)
{%          endif -%}
{%-     endfor -%}
{%- endif -%}