From ed262cad97daa9d00fe44a39fd04dfa4eb763d7b Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 15 Feb 2022 22:49:09 -0500 Subject: [PATCH] tests: do not use a GNU bash script to check the minimum version of programs find_program() can check that for us already, there's no need to require GNU bash on systems that default to other POSIX shells. Even though this is the *linuxlike* tests and a POSIX shell is guaranteed, there is actually no need to require a shell at all. It's *easier* to use the meson builtin functionality here. --- test cases/linuxlike/13 cmake dependency/cmVers.sh | 6 ------ test cases/linuxlike/13 cmake dependency/meson.build | 5 +---- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100755 test cases/linuxlike/13 cmake dependency/cmVers.sh diff --git a/test cases/linuxlike/13 cmake dependency/cmVers.sh b/test cases/linuxlike/13 cmake dependency/cmVers.sh deleted file mode 100755 index 6e096a5f8..000000000 --- a/test cases/linuxlike/13 cmake dependency/cmVers.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env 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 ae4cc425c..193ad184b 100644 --- a/test cases/linuxlike/13 cmake dependency/meson.build +++ b/test cases/linuxlike/13 cmake dependency/meson.build @@ -6,9 +6,6 @@ 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'), check: true).stdout().strip() - # Zlib is probably on all dev machines. dep = dependency('ZLIB', version : '>=1.2', method : 'cmake') @@ -69,7 +66,7 @@ test('zlibtest4', exe4) # Test some edge cases with spaces, etc. (but only for CMake >= 3.15) -if cm_vers.version_compare('>=3.15') +if find_program('cmake', required: false, version: '>=3.15').found() 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])