summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2023-05-06 16:29:35 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2023-05-06 16:59:01 +0200
commit93630ec7711dc7bd29200d9167b88ff9c86f5e6e (patch)
tree48de8826b23621ea878ad74c01041d890ca6b253
parent5f793bec896e2341f37899401869d7b4bf1ffefc (diff)
downloadlibxslt-93630ec7711dc7bd29200d9167b88ff9c86f5e6e.tar.gz
cmake: Use version script
-rw-r--r--CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 022f345a..a8e12c21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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})
@@ -28,6 +28,7 @@ include(CheckCSourceCompiles)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckLibraryExists)
+include(CheckLinkerFlag)
include(CheckSymbolExists)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
@@ -90,6 +91,14 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-Wredundant-decls -Wno-long-long -Wno-format-extra-args")
+
+ if(BUILD_SHARED_LIBS AND UNIX AND NOT APPLE)
+ check_linker_flag(C "LINKER:--undefined-version" FLAG_UNDEFINED_VERSION)
+ if (FLAG_UNDEFINED_VERSION)
+ target_link_options(LibXslt PRIVATE "LINKER:--undefined-version")
+ endif()
+ target_link_options(LibXslt PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxslt/libxslt.syms")
+ endif()
endif()
if(LIBXSLT_WITH_CRYPTO AND NOT WIN32)