{%- 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 %} {%- 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 custom_run.command|length > 1 %} ANTLER_ARGS {%- for arg in custom_run.command -%} {%- if not loop.first %} {{ arg }} {%- endif -%} {%- 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 -%}