Учитывать флаг 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,6 +16,7 @@ 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)
if(BUILD_SHARED_LIBS)
add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>) add_library(${LIBNAME}_shared SHARED $<TARGET_OBJECTS:${LIBNAME}>)
set_target_properties(${LIBNAME}_shared set_target_properties(${LIBNAME}_shared
PROPERTIES PROPERTIES
@ -23,6 +24,7 @@ function(add_common_library)
SOVERSION ${PROJECT_VERSION_MAJOR} SOVERSION ${PROJECT_VERSION_MAJOR}
OUTPUT_NAME ${LIBNAME} OUTPUT_NAME ${LIBNAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) 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