Учитывать флаг 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}>) $<INSTALL_INTERFACE:include/${LIBNAME}>)
set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>) if(BUILD_SHARED_LIBS)
set_target_properties(${LIBNAME}_shared add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
PROPERTIES set_target_properties(${LIBNAME}_shared
VERSION ${PROJECT_VERSION} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION}
OUTPUT_NAME ${LIBNAME} SOVERSION ${PROJECT_VERSION_MAJOR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) OUTPUT_NAME ${LIBNAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
endif()
add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>) add_library(${LIBNAME}_static STATIC $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_static set_target_properties(${LIBNAME}_static