1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

cmake: Link with --undefined-version

This commit is contained in:
Nick Wellnhofer 2023-04-29 20:43:54 +02:00
parent a8fe4900be
commit a5bc460583

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.18)
file(STRINGS "configure.ac" CONFIGURE_AC_LINES)
foreach(line ${CONFIGURE_AC_LINES})
@ -16,6 +16,7 @@ include(CheckCSourceCompiles)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckLinkerFlag)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CMakePackageConfigHelpers)
@ -337,7 +338,11 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
-Wredundant-decls -Wno-long-long -Wno-format-extra-args")
if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
target_link_options(LibXml2 PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
check_linker_flag(C "LINKER:--undefined-version" FLAG_UNDEFINED_VERSION)
if (FLAG_UNDEFINED_VERSION)
target_link_options(LibXml2 PRIVATE "LINKER:--undefined-version")
endif()
target_link_options(LibXml2 PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms")
endif()
endif()