From e9c36da60ecf832ee48b49d71c97b50663ee0e7d Mon Sep 17 00:00:00 2001 From: Daniel <19858862+Colum31@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:43:47 +0200 Subject: [PATCH 1/2] Implement default_library option --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 99bf3aff31..58164bff46 100644 --- a/meson.build +++ b/meson.build @@ -8,6 +8,7 @@ project( 'catch2', 'cpp', + default_options: ['default_library=static'], version: '3.7.1', # CML version placeholder, don't delete license: 'BSL-1.0', meson_version: '>=0.54.1', From c8b394e6cf21e3aa5154a203c803ba9acfe0c31f Mon Sep 17 00:00:00 2001 From: Daniel <19858862+Colum31@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:47:19 +0200 Subject: [PATCH 2/2] Use library() instead of static_library() Build type will be set by default_library, which default to static. However, shared libraries can be built, by passing -Ddefault_library=shared --- src/catch2/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/catch2/meson.build b/src/catch2/meson.build index 65be34378a..21765c4877 100644 --- a/src/catch2/meson.build +++ b/src/catch2/meson.build @@ -351,7 +351,7 @@ if ((host_machine.system() == 'android') or catch2_dependencies += log_dep endif -catch2 = static_library( +catch2 = library( 'Catch2', sources, dependencies: catch2_dependencies, @@ -371,7 +371,7 @@ pkg.generate( url: 'https://github.com/catchorg/Catch2', ) -catch2_with_main = static_library( +catch2_with_main = library( 'Catch2Main', 'internal/catch_main.cpp', link_with: catch2,