From f2d80aa6b8614e2863491f2f3e08b670f9e01c7a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 13 Apr 2026 23:58:57 +0100 Subject: [PATCH] Fix cmake ASAN build --- .github/workflows/mosquitto-cmake-asan.yml | 1 + libcommon/CMakeLists.txt | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/mosquitto-cmake-asan.yml b/.github/workflows/mosquitto-cmake-asan.yml index e05ea95c..b0a2b6cb 100644 --- a/.github/workflows/mosquitto-cmake-asan.yml +++ b/.github/workflows/mosquitto-cmake-asan.yml @@ -67,6 +67,7 @@ jobs: cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_SHARED_LIBCOMMON=ON \ -S . \ -B build env: diff --git a/libcommon/CMakeLists.txt b/libcommon/CMakeLists.txt index 8a5af5f7..6c349a20 100644 --- a/libcommon/CMakeLists.txt +++ b/libcommon/CMakeLists.txt @@ -29,6 +29,13 @@ option_env(ALLOC_MISMATCH_INVALID_READ "Memory function mismatch detection." OFF option_env(ALLOC_MISMATCH_ABORT "Memory function mismatch abort." OFF) if(WIN32) + set(WITH_SHARED_LIBCOMMON_DEF ON) +else() + set(WITH_SHARED_LIBCOMMON_DEF OFF) +endif() +option_env(WITH_SHARED_LIBCOMMON "Build libmosquitto_common as a shared library?" ${WITH_SHARED_LIBCOMMON_DEF}) + +if(WITH_SHARED_LIBCOMMON) add_library(libmosquitto_common SHARED ${C_SRC} )