mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-23 04:05:36 +00:00
link with version script only if linker supports it
This commit is contained in:
parent
66c7d1b1ac
commit
006d2050bd
|
@ -1,6 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 2.8.5)
|
cmake_minimum_required(VERSION 2.8.5)
|
||||||
project(libsoundio C)
|
project(libsoundio C)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.0.0)
|
if(CMAKE_VERSION VERSION_LESS 3.0.0)
|
||||||
set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "library install dir (lib)")
|
set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "library install dir (lib)")
|
||||||
|
@ -217,6 +218,13 @@ configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/src/link_version_script.in"
|
"${CMAKE_SOURCE_DIR}/src/link_version_script.in"
|
||||||
${LINK_VERSION_SCRIPT}
|
${LINK_VERSION_SCRIPT}
|
||||||
)
|
)
|
||||||
|
set(VERSION_SCRIPT_FLAG "-Wl,--version-script='${LINK_VERSION_SCRIPT}'")
|
||||||
|
check_c_compiler_flag("${VERSION_SCRIPT_FLAG}" VERSION_SCRIPT_OK)
|
||||||
|
if (VERSION_SCRIPT_OK)
|
||||||
|
set(SHARED_LINK_FLAGS "${VERSION_SCRIPT_FLAG}")
|
||||||
|
else()
|
||||||
|
set(SHARED_LINK_FLAGS " ")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES} ${LINK_VERSION_SCRIPT})
|
add_library(libsoundio_shared SHARED ${LIBSOUNDIO_SOURCES} ${LINK_VERSION_SCRIPT})
|
||||||
set_target_properties(libsoundio_shared PROPERTIES
|
set_target_properties(libsoundio_shared PROPERTIES
|
||||||
|
@ -225,7 +233,7 @@ set_target_properties(libsoundio_shared PROPERTIES
|
||||||
VERSION ${LIBSOUNDIO_VERSION}
|
VERSION ${LIBSOUNDIO_VERSION}
|
||||||
COMPILE_FLAGS ${LIB_CFLAGS}
|
COMPILE_FLAGS ${LIB_CFLAGS}
|
||||||
LINKER_LANGUAGE C
|
LINKER_LANGUAGE C
|
||||||
LINK_FLAGS "-Wl,--version-script='${LINK_VERSION_SCRIPT}'"
|
LINK_FLAGS "${SHARED_LINK_FLAGS}"
|
||||||
)
|
)
|
||||||
target_link_libraries(libsoundio_shared LINK_PUBLIC ${LIBSOUNDIO_LIBS})
|
target_link_libraries(libsoundio_shared LINK_PUBLIC ${LIBSOUNDIO_LIBS})
|
||||||
install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
Loading…
Reference in a new issue