From 66c7d1b1ac134758382e1942cfe523d69a22513c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 18 Nov 2015 14:29:31 -0700 Subject: [PATCH] add symbol versioning closes #40 --- CMakeLists.txt | 8 +++++++- src/link_version_script.in | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/link_version_script.in diff --git a/CMakeLists.txt b/CMakeLists.txt index be7239e..d451383 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,14 +212,20 @@ configure_file( "${CMAKE_SOURCE_DIR}/doc/doxygen.conf.in" ${DOXYGEN_CONF_FILE} ) +set(LINK_VERSION_SCRIPT "${CMAKE_BINARY_DIR}/link_version_script") +configure_file( + "${CMAKE_SOURCE_DIR}/src/link_version_script.in" + ${LINK_VERSION_SCRIPT} +) -add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES}) +add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES} ${LINK_VERSION_SCRIPT}) set_target_properties(libsoundio_shared PROPERTIES OUTPUT_NAME soundio SOVERSION ${LIBSOUNDIO_VERSION_MAJOR} VERSION ${LIBSOUNDIO_VERSION} COMPILE_FLAGS ${LIB_CFLAGS} LINKER_LANGUAGE C + LINK_FLAGS "-Wl,--version-script='${LINK_VERSION_SCRIPT}'" ) target_link_libraries(libsoundio_shared LINK_PUBLIC ${LIBSOUNDIO_LIBS}) install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/link_version_script.in b/src/link_version_script.in new file mode 100644 index 0000000..9060297 --- /dev/null +++ b/src/link_version_script.in @@ -0,0 +1,3 @@ +LIBSOUNDIO_@LIBSOUNDIO_VERSION_MAJOR@ { + global: *; +};