From 445c7d81f5df22923a32cbfc0a1a45c497ed5d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Balzarotti?= Date: Wed, 20 Jan 2021 10:29:22 +0100 Subject: [PATCH] meson: Use system doctest if available * meson.build (doctest_proj): check if available as system dependency * blurhash.cpp: change doctest include path to doctest/doctest.h --- blurhash.cpp | 2 +- meson.build | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/blurhash.cpp b/blurhash.cpp index a4adf89f..c17802ac 100644 --- a/blurhash.cpp +++ b/blurhash.cpp @@ -11,7 +11,7 @@ #endif #ifdef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN -#include +#include #endif using namespace std::literals; diff --git a/meson.build b/meson.build index 6000a65a..8cefcecd 100644 --- a/meson.build +++ b/meson.build @@ -6,8 +6,13 @@ lib = static_library('blurhash', 'blurhash.cpp', install : true) -doctest_proj = subproject('doctest') -doctest_dep = doctest_proj.get_variable('doctest_dep') +doctest_dep = dependency('doctest', required : false) + +if not doctest_dep.found() + doctest_proj = subproject('doctest') + doctest_dep = doctest_proj.get_variable('doctest_dep') +endif + tests = executable('blurhash-tests', 'blurhash.cpp', cpp_args : '-DDOCTEST_CONFIG_IMPLEMENT_WITH_MAIN',