aboutsummaryrefslogtreecommitdiff
path: root/test cases/linuxlike/13 cmake dependency/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/linuxlike/13 cmake dependency/meson.build')
-rw-r--r--test cases/linuxlike/13 cmake dependency/meson.build21
1 files changed, 14 insertions, 7 deletions
diff --git a/test cases/linuxlike/13 cmake dependency/meson.build b/test cases/linuxlike/13 cmake dependency/meson.build
index 79acc83..9918a71 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')
@@ -41,6 +44,8 @@ assert(depf2.found() == false, 'Invalid CMake targets should fail')
# Try to find cmMesonTestDep in a custom prefix
# setup_env.json is used by run_project_tests.py:_run_test to point to ./cmake_pref_env/
depPrefEnv = dependency('cmMesonTestDep', required : true, method : 'cmake')
+depPrefEnv1 = dependency('cmMesonTestF1', required : true, method : 'cmake')
+depPrefEnv2 = dependency('cmMesonTestF2', required : true, method : 'cmake')
# Try to find a dependency with a custom CMake module
@@ -48,14 +53,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