CMake: Build libraries with VERSION/SOVERSION

This takes advantage of SONAME and versioning on platforms that support it.
This commit is contained in:
Sam Edwards 2018-04-02 15:49:05 -06:00
parent aed544bf5f
commit 2f6c79b9e6
2 changed files with 7 additions and 0 deletions

View File

@ -47,6 +47,7 @@ include(AddFlexTarget) # Defines add_flex_target function
include(CompositeSources) # Defines composite_sources function
include(Interrogate) # Defines target_interrogate AND add_python_module
include(RunPzip) # Defines run_pzip function
include(Versioning) # Hooks 'add_library' to apply VERSION/SOVERSION
# Add the include path for source and header files generated by CMake
include_directories("${PROJECT_BINARY_DIR}/include")

View File

@ -0,0 +1,6 @@
function(add_library target_name)
_add_library("${target_name}" ${ARGN})
set_target_properties("${target_name}" PROPERTIES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
endfunction(add_library)