Browse Source

build(meson): use C++14 with GTest >= 1.13.0 (#1618)

GoogleTest, starting with vesion 1.13.0, requires C++14 to build. This
patch enables C++14 if GoogleTest 1.13.0 or newer is detected when
compiling the tests with Meson, making it possible to use new GTest
versions.

You can find GoogleTest's release notes at
<https://github.com/google/googletest/releases/tag/v1.13.0>.
Andrea Pappacoda 2 years ago
parent
commit
52d8dd41f1
1 changed files with 8 additions and 1 deletions
  1. 8 1
      test/meson.build

+ 8 - 1
test/meson.build

@@ -86,6 +86,12 @@ subdir(join_paths('www', 'dir'))
 subdir(join_paths('www2', 'dir'))
 subdir(join_paths('www2', 'dir'))
 subdir(join_paths('www3', 'dir'))
 subdir(join_paths('www3', 'dir'))
 
 
+# GoogleTest 1.13.0 requires C++14
+test_options = []
+if gtest_dep.version().version_compare('>=1.13.0')
+  test_options += 'cpp_std=c++14'
+endif
+
 test(
 test(
   'main',
   'main',
   executable(
   executable(
@@ -94,7 +100,8 @@ test(
     dependencies: [
     dependencies: [
       cpp_httplib_dep,
       cpp_httplib_dep,
       gtest_dep
       gtest_dep
-    ]
+    ],
+    override_options: test_options
   ),
   ),
   depends: [
   depends: [
     key_pem,
     key_pem,