meson: add tests ()

This integrates the "main" test suite (test/test.cc) in Meson.

This allows to run the tests in the CI with the Meson-built version of
the library to ensure that nothing breaks unexpectedly.

It also simplifies life of downstream packagers, that do not have to
write a custom build script to split the library and run tests but can
instead just let Meson do that for them.
This commit is contained in:
Andrea Pappacoda 2021-09-11 20:26:48 +02:00 committed by GitHub
parent 4e05368086
commit e3e28c6231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 179 additions and 5 deletions

View file

@ -7,6 +7,7 @@ project(
'cpp',
license: 'MIT',
default_options: [
'cpp_std=c++11',
'buildtype=release',
'b_ndebug=if-release',
'b_lto=true',
@ -71,7 +72,7 @@ if brotli_found_all
args += '-DCPPHTTPLIB_BROTLI_SUPPORT'
endif
cpp_httplib_dep = dependency('', required : false)
cpp_httplib_dep = dependency('', required: false)
if get_option('cpp-httplib_compile')
httplib_ch = custom_target(
@ -106,3 +107,7 @@ endif
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('cpp-httplib', cpp_httplib_dep)
endif
if get_option('cpp-httplib_test')
subdir('test')
endif