diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-05-28 16:57:10 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-06-06 18:27:05 +0200 |
commit | 2f998cd8d5ab7f794b86fdf9d34630b645b8a72b (patch) | |
tree | b867cc0a9e15cdfd97ab0fc6434f1c26e82a13b5 /test cases | |
parent | e02c1015750fb9a5a15a9d0930281cd78e012133 (diff) | |
download | meson-2f998cd8d5ab7f794b86fdf9d34630b645b8a72b.zip meson-2f998cd8d5ab7f794b86fdf9d34630b645b8a72b.tar.gz meson-2f998cd8d5ab7f794b86fdf9d34630b645b8a72b.tar.bz2 |
cmake: Updated test cases
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/cmake/1 basic/meson.build | 9 | ||||
-rw-r--r-- | test cases/cmake/2 advanced/meson.build | 14 | ||||
-rw-r--r-- | test cases/cmake/3 advanced no dep/meson.build | 14 | ||||
-rw-r--r-- | test cases/cmake/4 code gen/meson.build | 6 | ||||
-rw-r--r-- | test cases/cmake/5 object library/meson.build | 8 | ||||
-rw-r--r-- | test cases/cmake/6 object library no dep/meson.build | 8 | ||||
-rw-r--r-- | test cases/cmake/7 cmake options/meson.build | 2 |
7 files changed, 34 insertions, 27 deletions
diff --git a/test cases/cmake/1 basic/meson.build b/test cases/cmake/1 basic/meson.build index eaa1e7a..a23063d 100644 --- a/test cases/cmake/1 basic/meson.build +++ b/test cases/cmake/1 basic/meson.build @@ -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) diff --git a/test cases/cmake/2 advanced/meson.build b/test cases/cmake/2 advanced/meson.build index 5f949f4..385a49b 100644 --- a/test cases/cmake/2 advanced/meson.build +++ b/test cases/cmake/2 advanced/meson.build @@ -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')) diff --git a/test cases/cmake/3 advanced no dep/meson.build b/test cases/cmake/3 advanced no dep/meson.build index b4469f3..c10dbf5 100644 --- a/test cases/cmake/3 advanced no dep/meson.build +++ b/test cases/cmake/3 advanced no dep/meson.build @@ -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')) diff --git a/test cases/cmake/4 code gen/meson.build b/test cases/cmake/4 code gen/meson.build index a592dfb..592f903 100644 --- a/test cases/cmake/4 code gen/meson.build +++ b/test cases/cmake/4 code gen/meson.build @@ -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( diff --git a/test cases/cmake/5 object library/meson.build b/test cases/cmake/5 object library/meson.build index 76e16be..268c2be 100644 --- a/test cases/cmake/5 object library/meson.build +++ b/test cases/cmake/5 object library/meson.build @@ -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') diff --git a/test cases/cmake/6 object library no dep/meson.build b/test cases/cmake/6 object library no dep/meson.build index 8e1eaf9..7494fee 100644 --- a/test cases/cmake/6 object library no dep/meson.build +++ b/test cases/cmake/6 object library no dep/meson.build @@ -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]) diff --git a/test cases/cmake/7 cmake options/meson.build b/test cases/cmake/7 cmake options/meson.build index 55813fb..8bb6d1d 100644 --- a/test cases/cmake/7 cmake options/meson.build +++ b/test cases/cmake/7 cmake options/meson.build @@ -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') |