From 173a2634904875b0926615cc659e8f108115ea20 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 20 Apr 2022 13:00:41 +0200 Subject: [PATCH] Correctly set default visibility on non-windows compilers This fixes compilation of pugixml with -fvisibility=hidden. Without this patch, one would get lots of unresolved symbols when consuming pugixml as a shared library. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17f67d1..d309509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,9 @@ if (BUILD_SHARED_LIBS) ${PUGIXML_BUILD_DEFINES} ${PUGIXML_PUBLIC_DEFINITIONS} PRIVATE - $<$:PUGIXML_API=__declspec\(dllexport\)>) + $<$:PUGIXML_API=__declspec\(dllexport\)> + $,,PUGIXML_API=__attribute__\(\(visibility\("default"\)\)\)> + ) target_compile_options(pugixml-shared PRIVATE ${msvc-rt-mtd-shared}