diff --git a/meson.build b/meson.build
index 4238adb..d3f89fd 100644
--- a/meson.build
+++ b/meson.build
@@ -43,8 +43,8 @@ if dataroot_dir == ''
     dataroot_dir = datadir
 endif
 
-installed_tests_dir = prefix / libexecdir / 'installed-tests' / meson.project_name()
-installed_tests_data_dir = prefix / datadir / 'installed-tests' / meson.project_name()
+installed_tests_dir = get_option('installed_test_prefix') / 'libexec' / 'installed-tests' / meson.project_name()
+installed_tests_data_dir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / meson.project_name()
 docs_dir = datadir / 'doc' / meson.project_name()
 
 summary({
diff --git a/meson_options.txt b/meson_options.txt
index ed8c311..0a2bf7e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -54,3 +54,7 @@ option('sandboxed-sound-validation',
        type: 'feature',
        value: 'enabled',
        description: 'Use Bubblewrap to sandbox sound validation. Disabling this option may lead to security vulnerabilities.')
+option('installed_test_prefix',
+       type: 'string',
+       value: '',
+       description: 'Prefix for installed tests')
