Allow overriding static lib name

This helps alleviate cases where compilers will choose to link against the dynamic library instead of the static based on name alone (in which you don't have much control, or don't wish to tinker too much with the compiler args)
This commit is contained in:
Corey Powell 2016-06-30 10:45:08 -05:00
parent ccf9545bc5
commit 425dc4bf69

View file

@ -23,6 +23,10 @@ set(LIBSOUNDIO_VERSION_PATCH 0)
set(LIBSOUNDIO_VERSION "${LIBSOUNDIO_VERSION_MAJOR}.${LIBSOUNDIO_VERSION_MINOR}.${LIBSOUNDIO_VERSION_PATCH}")
message("Configuring libsoundio version ${LIBSOUNDIO_VERSION}")
if(NOT SOUNDIO_STATIC_LIBNAME)
set(SOUNDIO_STATIC_LIBNAME soundio)
endif()
option(BUILD_STATIC_LIBS "Build static libraries" ON)
option(BUILD_EXAMPLE_PROGRAMS "Build example programs" ON)
option(BUILD_TESTS "Build tests" ON)
@ -233,7 +237,7 @@ install(TARGETS libsoundio_shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(BUILD_STATIC_LIBS)
add_library(libsoundio_static STATIC ${LIBSOUNDIO_SOURCES})
set_target_properties(libsoundio_static PROPERTIES
OUTPUT_NAME soundio
OUTPUT_NAME ${SOUNDIO_STATIC_LIBNAME}
COMPILE_FLAGS ${LIB_CFLAGS}
LINKER_LANGUAGE C
)