parent
e02c101575
commit
2f998cd8d5
7 changed files with 34 additions and 27 deletions
@ -1,7 +1,12 @@ |
||||
project('cmakeSubTest', ['c', 'cpp']) |
||||
|
||||
sub_pro = subproject('cmMod', method: 'cmake') |
||||
sub_dep = sub_pro.get_variable('cmModLib_dep') |
||||
cm = import('cmake') |
||||
|
||||
sub_pro = cm.subproject('cmMod') |
||||
sub_dep = sub_pro.dependency('cmModLib') |
||||
|
||||
assert(sub_pro.target_list() == ['cmModLib'], 'There should be exactly one target') |
||||
assert(sub_pro.target_type('cmModLib') == 'shared_library', 'Target type should be shared_library') |
||||
|
||||
exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) |
||||
test('test1', exe1) |
||||
|
@ -1,17 +1,15 @@ |
||||
project('cmakeSubTest_advanced', ['c', 'cpp']) |
||||
|
||||
# Test the "normal" subproject call |
||||
sub_pro = subproject('cmMod') |
||||
sub_dep = sub_pro.get_variable('cmModLib_dep') |
||||
cm = import('cmake') |
||||
|
||||
# Test the dependency shortcut |
||||
shortcut_dep = dependency('ttabadbneiobevn', fallback: ['cmMod', 'cmModLib_dep']) |
||||
# Test the "normal" subproject call |
||||
sub_pro = cm.subproject('cmMod') |
||||
sub_dep = sub_pro.dependency('cmModLib') |
||||
|
||||
# Build some files |
||||
exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) |
||||
exe2 = executable('main2', ['main.cpp'], dependencies: [shortcut_dep]) |
||||
test('test1', exe1) |
||||
test('test2', exe2) |
||||
|
||||
# Test if we can also extract executables |
||||
test('test3', sub_pro.get_variable('testEXE')) |
||||
assert(sub_pro.target_type('testEXE') == 'executable', 'The type must be executable for obvious reasons') |
||||
test('test2', sub_pro.target('testEXE')) |
||||
|
@ -1,3 +1,3 @@ |
||||
project('cmake_set_opt', ['c', 'cpp']) |
||||
|
||||
subproject('cmOpts', method: 'cmake', cmake_options: '-DSOME_CMAKE_VAR=something') |
||||
import('cmake').subproject('cmOpts', cmake_options: '-DSOME_CMAKE_VAR=something') |
||||
|
Loading…
Reference in new issue