| 1 |
project('cmake_code_gen', ['c', 'cpp']) |
| 2 |
|
| 3 |
if meson.is_cross_build() |
| 4 |
error('MESON_SKIP_TEST this test does not cross compile correctly.') |
| 5 |
endif |
| 6 |
|
| 7 |
cm = import('cmake') |
| 8 |
|
| 9 |
# Subproject with the "code generator" |
| 10 |
sub_pro = cm.subproject('cmCodeGen') |
| 11 |
sub_exe = sub_pro.target('genA') |
| 12 |
|
| 13 |
# Generate the source |
| 14 |
generated = custom_target( |
| 15 |
'cmake-generated', |
| 16 |
input: [], |
| 17 |
output: ['test.cpp'], |
| 18 |
command: [sub_exe, '@OUTPUT@'] |
| 19 |
) |
| 20 |
|
| 21 |
# Build the exe |
| 22 |
exe1 = executable('main1', ['main.cpp', generated]) |
| 23 |
|
| 24 |
test('test1', exe1) |