From f8b048656b9937252ce5fb4ebea9e5df5b203bdb Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Wed, 27 May 2020 09:40:59 +0100 Subject: [PATCH] cmake: Don't export symbols if building static library --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f9ab07..67b4f33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,10 +50,16 @@ set(CMAKE_DEBUG_POSTFIX "d") add_library(tinyxml2 tinyxml2.cpp tinyxml2.h) -set_target_properties(tinyxml2 PROPERTIES +if(BUILD_SHARED_LIBS) + set_target_properties(tinyxml2 PROPERTIES COMPILE_DEFINITIONS "TINYXML2_EXPORT" - VERSION "${GENERIC_LIB_VERSION}" - SOVERSION "${GENERIC_LIB_SOVERSION}") + VERSION "${GENERIC_LIB_VERSION}" + SOVERSION "${GENERIC_LIB_SOVERSION}") +else() + set_target_properties(tinyxml2 PROPERTIES + VERSION "${GENERIC_LIB_VERSION}" + SOVERSION "${GENERIC_LIB_SOVERSION}") +endif() target_compile_definitions(tinyxml2 PUBLIC $<$:TINYXML2_DEBUG>) -- 2.25.1.windows.1