| 1 |
project('cmakeSubTest_advanced', ['c', 'cpp']) |
| 2 |
|
| 3 |
dep_test = dependency('ZLIB', method: 'cmake', required: false) |
| 4 |
if not dep_test.found() |
| 5 |
error('MESON_SKIP_TEST: zlib is not installed') |
| 6 |
endif |
| 7 |
|
| 8 |
cm = import('cmake') |
| 9 |
|
| 10 |
# Test the "normal" subproject call |
| 11 |
sub_pro = cm.subproject('cmMod') |
| 12 |
sub_dep = sub_pro.dependency('cmModLib') |
| 13 |
sub_sta = sub_pro.dependency('cmModLibStatic') |
| 14 |
|
| 15 |
# Build some files |
| 16 |
exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) |
| 17 |
exe2 = executable('main2', ['main.cpp'], dependencies: [sub_sta]) |
| 18 |
slib = shared_library('slib', ['slib.cpp'], dependencies: [sub_dep]) |
| 19 |
exe3 = executable('main3', ['main3.cpp'], link_with: slib) |
| 20 |
test('test1', exe1) |
| 21 |
test('test2', exe2) |
| 22 |
|
| 23 |
# Test if we can also extract executables |
| 24 |
assert(sub_pro.target_type('testEXE') == 'executable', 'The type must be executable for obvious reasons') |
| 25 |
test('test3', sub_pro.target('testEXE')) |
| 26 |
|
| 27 |
# Test that we can add a new target with the same name as the CMake subproject |
| 28 |
exe4 = executable('testEXE', ['main.cpp'], dependencies: [sub_sta]) |
| 29 |
test('test4', exe4) |