cmake: Updated test cases
This commit is contained in:
parent
e02c101575
commit
2f998cd8d5
|
@ -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)
|
||||
|
|
|
@ -5,18 +5,16 @@ if not dep_test.found()
|
|||
error('MESON_SKIP_TEST: zlib is not installed')
|
||||
endif
|
||||
|
||||
# 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,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,8 +1,10 @@
|
|||
project('cmake_code_gen', ['c', 'cpp'])
|
||||
|
||||
cm = import('cmake')
|
||||
|
||||
# Subproject with the "code generator"
|
||||
sub_pro = subproject('cmCodeGen')
|
||||
sub_exe = sub_pro.get_variable('genA')
|
||||
sub_pro = cm.subproject('cmCodeGen')
|
||||
sub_exe = sub_pro.target('genA')
|
||||
|
||||
# Generate the source
|
||||
generated = custom_target(
|
||||
|
|
|
@ -9,9 +9,11 @@ if build_machine.system() == 'windows'
|
|||
error('MESON_SKIP_TEST: Windows is not supported because of symbol export problems')
|
||||
endif
|
||||
|
||||
sub_pro = subproject('cmObjLib')
|
||||
sub_sha = sub_pro.get_variable('lib_sha_dep')
|
||||
sub_sta = sub_pro.get_variable('lib_sta_dep')
|
||||
cm = import('cmake')
|
||||
|
||||
sub_pro = cm.subproject('cmObjLib')
|
||||
sub_sha = sub_pro.dependency('lib_sha')
|
||||
sub_sta = sub_pro.dependency('lib_sta')
|
||||
|
||||
# Required for the static library
|
||||
zlib_dep = dependency('zlib')
|
||||
|
|
|
@ -4,9 +4,11 @@ if build_machine.system() == 'windows'
|
|||
error('MESON_SKIP_TEST: Windows is not supported because of symbol export problems')
|
||||
endif
|
||||
|
||||
sub_pro = subproject('cmObjLib')
|
||||
sub_sha = sub_pro.get_variable('lib_sha_dep')
|
||||
sub_sta = sub_pro.get_variable('lib_sta_dep')
|
||||
cm = import('cmake')
|
||||
|
||||
sub_pro = cm.subproject('cmObjLib')
|
||||
sub_sha = sub_pro.dependency('lib_sha')
|
||||
sub_sta = sub_pro.dependency('lib_sta')
|
||||
|
||||
exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha])
|
||||
exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta])
|
||||
|
|
|
@ -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