1diff --git a/installed-tests/meson.build b/installed-tests/meson.build
2index 04c7910f..9647908c 100644
3--- a/installed-tests/meson.build
4+++ b/installed-tests/meson.build
5@@ -1,7 +1,7 @@
6 ### Installed tests ############################################################
7
8-installed_tests_execdir = get_option('prefix') / get_option('libexecdir') / 'installed-tests' / meson.project_name()
9-installed_tests_metadir = abs_datadir / 'installed-tests' / meson.project_name()
10+installed_tests_execdir = get_option('installed_test_prefix') / 'libexec' / 'installed-tests' / meson.project_name()
11+installed_tests_metadir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / meson.project_name()
12
13 # Simple shell script tests #
14
15diff --git a/meson.build b/meson.build
16index 9ab29475..42ffe07f 100644
17--- a/meson.build
18+++ b/meson.build
19@@ -557,7 +557,7 @@ install_data('installed-tests/extra/lsan.supp',
20 install_dir: get_option('datadir') / api_name / 'lsan')
21
22 if get_option('installed_tests')
23- schemadir = abs_datadir / 'glib-2.0' / 'schemas'
24+ schemadir = get_option('installed_test_prefix') / 'share' / 'glib-2.0' / 'schemas'
25 install_data('installed-tests/js/org.gnome.GjsTest.gschema.xml', install_dir: schemadir)
26 meson.add_install_script('build/compile-gschemas.py', schemadir)
27 endif
28diff --git a/meson_options.txt b/meson_options.txt
29index 825ba77a..21f0323c 100644
30--- a/meson_options.txt
31+++ b/meson_options.txt
32@@ -25,3 +25,5 @@ option('skip_gtk_tests', type: 'boolean', value: false,
33 description: 'Skip tests that need a display connection')
34 option('verbose_logs', type: 'boolean', value: false,
35 description: 'Enable extra log messages that may decrease performance (not allowed in release builds)')
36+option('installed_test_prefix', type: 'string', value: '',
37+ description: 'Prefix for installed tests')