| 1 |
project('cmakeSubTest', ['c', 'cpp']) |
| 2 |
|
| 3 |
# Fallback to a CMake subproject |
| 4 |
sub_dep = dependency('cmModLib++', version: '>=1.2.3') |
| 5 |
exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) |
| 6 |
test('test1', exe1) |
| 7 |
|
| 8 |
# Subproject contains both meson.build and CMakeLists.txt. It should default |
| 9 |
# to meson but wrap force cmake. |
| 10 |
subproject('force_cmake') |
| 11 |
|
| 12 |
testcase expect_error('Wrap method \'notfound\' is not supported, must be one of: meson, cmake, cargo') |
| 13 |
subproject('broken_method') |
| 14 |
endtestcase |
| 15 |
|
| 16 |
# With method=meson we can't use cmake.subproject() |
| 17 |
cmake = import('cmake') |
| 18 |
testcase expect_error('Wrap method is \'meson\' but we are trying to configure it with cmake') |
| 19 |
cmake.subproject('meson_method') |
| 20 |
endtestcase |
| 21 |
|
| 22 |
# cmake.subproject() force cmake method even if meson.build exists. |
| 23 |
testcase expect_error('Subproject exists but has no CMakeLists.txt file.') |
| 24 |
cmake.subproject('meson_subp') |
| 25 |
endtestcase |
| 26 |
|
| 27 |
# Without specifying the method it defaults to meson even if CMakeLists.txt exists. |
| 28 |
testcase expect_error('Subproject exists but has no meson.build file.') |
| 29 |
subproject('cmake_subp') |
| 30 |
endtestcase |