summaryrefslogtreecommitdiff
path: root/test_support
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-07-12 18:16:06 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-07-12 18:16:20 +0200
commit2b3fc8f53de9d0d547e4e5b7900c7257bdd1be1a (patch)
tree8f6d4a8fb680727cecd791c68ba187e333222f18 /test_support
parent087e99c2ba0ddd7928208f3dc244c567b6d0b0dd (diff)
downloadturns-2b3fc8f53de9d0d547e4e5b7900c7257bdd1be1a.tar.xz
turns-2b3fc8f53de9d0d547e4e5b7900c7257bdd1be1a.zip
domain/tests: initialize glib
Diffstat (limited to 'test_support')
-rw-r--r--test_support/CMakeLists.txt20
-rw-r--r--test_support/src/glib_main.cpp10
2 files changed, 30 insertions, 0 deletions
diff --git a/test_support/CMakeLists.txt b/test_support/CMakeLists.txt
index bb2ae4f..ce77a90 100644
--- a/test_support/CMakeLists.txt
+++ b/test_support/CMakeLists.txt
@@ -1,5 +1,25 @@
get_target_property(TRANSLATIONS_BINARY_DIR "lang" BINARY_DIR)
+# Glib test support
+
+add_library("test_support-glib" OBJECT
+ "src/glib_main.cpp"
+)
+
+add_library("turns::glib-test-main" ALIAS "test_support-glib")
+
+target_compile_features("test_support-glib" PRIVATE
+ "cxx_std_23"
+)
+
+target_compile_definitions("test_support-glib" PUBLIC
+ "TESTLOCALEDIR=\"${TRANSLATIONS_BINARY_DIR}\""
+)
+
+target_link_libraries("test_support-glib" PUBLIC
+ "PkgConfig::glibmm"
+)
+
# GTK test support
add_library("test_support-gtk" OBJECT
diff --git a/test_support/src/glib_main.cpp b/test_support/src/glib_main.cpp
new file mode 100644
index 0000000..d224bad
--- /dev/null
+++ b/test_support/src/glib_main.cpp
@@ -0,0 +1,10 @@
+#include <catch2/catch_session.hpp>
+
+#include <glibmm/init.h>
+
+auto main(int argc, char * argv[]) -> int
+{
+ Glib::init();
+
+ return Catch::Session().run(argc, argv);
+} \ No newline at end of file