Учитывать флаг BUILD_STATIC_LIBS

This commit is contained in:
Andrei Astafev 2019-03-06 12:21:55 +03:00
parent c21b108b47
commit e90a2d9e7e

View File

@ -16,13 +16,15 @@ function(add_common_library)
$<INSTALL_INTERFACE:include/${LIBNAME}>)
set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_shared
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
OUTPUT_NAME ${LIBNAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
if(BUILD_SHARED_LIBS)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_shared
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
OUTPUT_NAME ${LIBNAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
endif()
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_static