diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-04-05 18:53:24 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-04-28 17:54:02 +0200 |
commit | 20bacf82eea4bd0d3732c398298c27e0d82a526d (patch) | |
tree | 0b55c1f073f2d605f091d529f74294392c7ee9c0 /test cases | |
parent | 4640f13faa899a2de58ef4d835605f53b46550f3 (diff) | |
download | meson-20bacf82eea4bd0d3732c398298c27e0d82a526d.zip meson-20bacf82eea4bd0d3732c398298c27e0d82a526d.tar.gz meson-20bacf82eea4bd0d3732c398298c27e0d82a526d.tar.bz2 |
tests: Avoid a CMake error by checking the CMake version
Diffstat (limited to 'test cases')
-rwxr-xr-x | test cases/linuxlike/13 cmake dependency/cmVers.sh | 6 | ||||
-rw-r--r-- | test cases/linuxlike/13 cmake dependency/meson.build | 19 |
2 files changed, 18 insertions, 7 deletions
diff --git a/test cases/linuxlike/13 cmake dependency/cmVers.sh b/test cases/linuxlike/13 cmake dependency/cmVers.sh new file mode 100755 index 0000000..70809de --- /dev/null +++ b/test cases/linuxlike/13 cmake dependency/cmVers.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +VERS=$(cmake --version | grep "cmake version") +VERS=${VERS//cmake version/} + +echo -n $VERS diff --git a/test cases/linuxlike/13 cmake dependency/meson.build b/test cases/linuxlike/13 cmake dependency/meson.build index 79acc83..93824ab 100644 --- a/test cases/linuxlike/13 cmake dependency/meson.build +++ b/test cases/linuxlike/13 cmake dependency/meson.build @@ -6,6 +6,9 @@ if not find_program('cmake', required: false).found() error('MESON_SKIP_TEST cmake binary not available.') endif +# CMake version +cm_vers = run_command(find_program('./cmVers.sh')).stdout().strip() + # Zlib is probably on all dev machines. dep = dependency('ZLIB', version : '>=1.2', method : 'cmake') @@ -48,14 +51,16 @@ depm1 = dependency('SomethingLikeZLIB', required : true, components : 'required_ depm2 = dependency('SomethingLikeZLIB', required : true, components : 'required_comp', method : 'cmake', cmake_module_path : ['cmake']) depm3 = dependency('SomethingLikeZLIB', required : true, components : ['required_comp'], cmake_module_path : 'cmake') -# Test some edge cases with spaces, etc. +# Test some edge cases with spaces, etc. (but only for CMake >= 3.15) -testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs') -testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs']) -testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1]) -testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2]) -test('testFlagSetTest1', testFlagSet1) -test('testFlagSetTest2', testFlagSet2) +if cm_vers.version_compare('>=3.15') + testDep1 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'mesonTestLibDefs') + testDep2 = dependency('ImportedTarget', required : true, method : 'cmake', cmake_module_path : 'cmake', modules : ['MesonTest::TestLibDefs']) + testFlagSet1 = executable('testFlagSet1', ['testFlagSet.c'], dependencies: [testDep1]) + testFlagSet2 = executable('testFlagSet2', ['testFlagSet.c'], dependencies: [testDep2]) + test('testFlagSetTest1', testFlagSet1) + test('testFlagSetTest2', testFlagSet2) +endif # Try to compile a test that takes a dep and an include_directories |