summaryrefslogtreecommitdiffstats
path: root/test cases/cmake/11 cmake_module_path/meson.build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/cmake/11 cmake_module_path/meson.build
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/cmake/11 cmake_module_path/meson.build')
-rw-r--r--test cases/cmake/11 cmake_module_path/meson.build25
1 files changed, 25 insertions, 0 deletions
diff --git a/test cases/cmake/11 cmake_module_path/meson.build b/test cases/cmake/11 cmake_module_path/meson.build
new file mode 100644
index 0000000..e201936
--- /dev/null
+++ b/test cases/cmake/11 cmake_module_path/meson.build
@@ -0,0 +1,25 @@
+# We use Python3 as it's the only thing guaranteed to be available on any platform Meson can run on (unlike Zlib in linuxlike/13 cmake dependency).
+
+project('user CMake find_package module using cmake_module_path', ['c', 'cpp'],
+ meson_version: '>= 0.55.0')
+
+if not find_program('cmake', required: false).found()
+ error('MESON_SKIP_TEST cmake binary not available.')
+endif
+
+# NOTE: can't request Python3 via dependency('Python3', method: 'cmake')
+# Meson intercepts and wants "method: auto"
+
+# Try to find a dependency with a custom CMake module
+
+dependency('SomethingLikePython', required : true, method : 'cmake', cmake_module_path : 'cmake', modules: 'Python::Interpreter')
+
+dependency('SomethingLikePython', method : 'cmake', cmake_module_path : ['doesNotExist', 'cmake'], modules: 'Python::Interpreter')
+
+# Test a custom target with Python::Interpreter in COMMAND
+cm = import('cmake')
+op = cm.subproject_options()
+op.add_cmake_defines({'CMAKE_MODULE_PATH': meson.source_root() / 'cmake'})
+sp = cm.subproject('cmMod', options: op)
+main = sp.target('main')
+test('main', main)