diff options
author | Patryk Obara <dreamer.tan@gmail.com> | 2021-02-27 18:06:30 +0300 |
---|---|---|
committer | Patryk Obara <dreamer.tan@gmail.com> | 2021-02-27 18:06:30 +0300 |
commit | 4428fcc6e5b0a358103b8a306868ecb48b5af393 (patch) | |
tree | e1ceb30854a835741f17f403a945def0ec9d1b46 | |
parent | 53a75de9e1248128d93d605987e6b459099bdf41 (diff) |
Bring back previous solution for detecting gtestpo/test-ut-disabler
Except now respect the user-selected 'unit_tests' feature.
This way unit tests will be automatically disabled for debug builds when
gtest is not installed and user passes wrap-mode nofallback or
nodownload.
-rw-r--r-- | tests/meson.build | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/meson.build b/tests/meson.build index 331c00d14..c417e684f 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,25 +1,26 @@ # gtest dependency # -# User opt-in/out, or disabled for release builds +# If feature 'unit_tests' is set to 'auto', then unit tests are disabled +# for release builds and enabled everywhere else. # -if (get_option('unit_tests').disabled() or - (get_option('buildtype') == 'release' and get_option('unit_tests').auto())) - gtest_dep = disabler() -else - # - # Meson will first try to find pre-installed gtest via pkg-config; - # if this fails, it will download wrap dependency (subproject). - # - # Users can further configure the download behaviour using: - # - # meson setup --wrap-mode={nofallback,nodownload,forcefallback} - # - # If gtest is not available at all, unit tests will be disabled. - # +# Meson will first try to find pre-installed gtest via pkg-config; +# if this fails, it will download wrap dependency (subproject). +# +# Users can further configure the download behaviour using: +# +# meson setup --wrap-mode={nofallback,nodownload,forcefallback} +# +# If gtest is not available at all, unit tests will be disabled. +# +gtest_dep = optional_dep +if not (get_option('buildtype') == 'release' and get_option('unit_tests').auto()) gtest_dep = dependency('gtest', main : true, - required : false, + required : get_option('unit_tests'), fallback : ['gtest', 'gtest_main_dep']) endif +if not gtest_dep.found() + gtest_dep = disabler() +endif # unit tests with specific requirements # |