| 1 |
project('rewrite tricky dataflow', 'c') |
| 2 |
|
| 3 |
# Adding a file to `begin` will add this file to the sources of `tgt1`, but |
| 4 |
# not to any other target. But a buggy rewriter might think that adding a file |
| 5 |
# to `begin` will also add this file to `end` and will refuse to add a file to |
| 6 |
# `begin`. |
| 7 |
begin = ['foo.c'] |
| 8 |
tgt1 = library('tgt1', begin) |
| 9 |
distraction = executable('distraction', link_with: tgt1) |
| 10 |
|
| 11 |
|
| 12 |
tgt2_srcs = ['foo.c'] |
| 13 |
if host_machine.system() == 'windows' # Some condition that cannot be known statically |
| 14 |
tgt2_srcs += ['bar.c'] |
| 15 |
endif |
| 16 |
executable('tgt2', tgt2_srcs) |
| 17 |
|
| 18 |
|
| 19 |
tgt34_srcs = ['foo.c'] |
| 20 |
executable('tgt3', tgt34_srcs) |
| 21 |
if host_machine.system() == 'windows' |
| 22 |
tgt34_srcs += ['bar.c'] |
| 23 |
endif |
| 24 |
executable('tgt4', tgt34_srcs) |
| 25 |
|
| 26 |
|
| 27 |
dont_add_here_5 = ['foo.c'] |
| 28 |
ct = custom_target('ct', output: 'out.c', input: dont_add_here_5, command: ['placeholder', '@INPUT@', '@OUTPUT@']) |
| 29 |
executable('tgt5', ct) |
| 30 |
|
| 31 |
|
| 32 |
dont_add_here_6 = ['foo.c'] |
| 33 |
gen = generator(find_program('cp'), output: '@BASENAME@_copy.c', arguments: ['@INPUT@', '@OUTPUT@']) |
| 34 |
generated = gen.process(dont_add_here_6) |
| 35 |
executable('tgt6', generated) |
| 36 |
|
| 37 |
if false |
| 38 |
# Should produce a warning, but should not crash |
| 39 |
var = not_defined_1 |
| 40 |
executable('tgt7', not_defined_2, var) |
| 41 |
endif |