From 47211f43e9edc1eb0f81ab4e502f0bb59c549627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 6 Mar 2022 14:46:12 +0100 Subject: [PATCH] Disable tinyglib for Qt builds on Linux/BSD --- src/network/slirp/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/network/slirp/CMakeLists.txt b/src/network/slirp/CMakeLists.txt index 5bb4bceca..f3fa9348b 100644 --- a/src/network/slirp/CMakeLists.txt +++ b/src/network/slirp/CMakeLists.txt @@ -21,14 +21,19 @@ if(WIN32) target_link_libraries(slirp wsock32 iphlpapi) endif() -option(SLIRP_GLIB "Use GLib proper with SLiRP" OFF) +# tinyglib conflicts with the real GLib used by Qt, let's just be safe +if(QT AND UNIX AND NOT APPLE) + set(SLIRP_TINYGLIB OFF) +endif() -if(SLIRP_GLIB) +option(SLIRP_TINYGLIB "Use a minimal GLib stub (`tinyglib`) with SLiRP" ON) + +if(SLIRP_TINYGLIB) + target_sources(slirp PRIVATE tinyglib.c) +else() find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) target_link_libraries(slirp PkgConfig::GLIB) target_compile_definitions(slirp PRIVATE TINYGLIB_USE_GLIB) -else() - target_sources(slirp PRIVATE tinyglib.c) endif()