[libxml2] cmake: Use symbol versioning on UNIX-like platforms



commit 88012a387922c77e95b6a075290e3548891a2970
Author: Daniel E <daniel engberg lists pyret net>
Date:   Wed Jul 13 21:02:50 2022 +0000

    cmake: Use symbol versioning on UNIX-like platforms
    
    Use symbol versioning to follow GNU Autotools more closely

 CMakeLists.txt | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b5425e1..bf97b042 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -367,6 +367,12 @@ if(NOT BUILD_SHARED_LIBS)
        set(XML_CFLAGS "-DLIBXML_STATIC")
 endif()
 
+if(BUILD_SHARED_LIBS AND UNIX)
+       if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
+               target_link_options(LibXml2 PRIVATE 
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
+       endif()
+endif()
+
 if(LIBXML2_WITH_THREADS)
        target_compile_definitions(LibXml2 PRIVATE _REENTRANT)
        if(WIN32)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]