From 2a741e657f37bc5ba0812d9e5f203c5771f15188 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Tue, 12 Feb 2019 23:02:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82?= =?UTF-8?q?=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommonLibraryTarget.cmake | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/CMLibCommonLibraryTarget.cmake b/CMLibCommonLibraryTarget.cmake index c9bd52f..2891f78 100644 --- a/CMLibCommonLibraryTarget.cmake +++ b/CMLibCommonLibraryTarget.cmake @@ -1,27 +1,24 @@ -# Create a shared and static library +# Создание статической и динамической библиотеки из одинаковых объектных файлов function(add_common_library LIBNAME SOURCES) add_library(${LIBNAME} OBJECT ${SOURCES}) target_include_directories(${LIBNAME} PUBLIC $ $ $) - get_property(VER GLOBAL PROPERTY VERSION_STR) - get_property(SOVER GLOBAL PROPERTY VERSION_MAJOR) - set_property(TARGET ${LIBNAME} PROPERTY VERSION "${VER}") - set_property(TARGET ${LIBNAME} PROPERTY SOVERSION "${SOVER}") - set_property(TARGET ${LIBNAME} PROPERTY POSITION_INDEPENDENT_CODE ON) + set_target_properties(${LIBNAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) add_library(${LIBNAME}_shared SHARED $) - set_target_properties(${LIBNAME}_shared PROPERTIES OUTPUT_NAME ${LIBNAME}) + get_property(_ver GLOBAL PROPERTY VERSION_STR) + get_property(_sover GLOBAL PROPERTY VERSION_MAJOR) + set_target_properties(${LIBNAME}_shared PROPERTIES + VERSION ${_ver} + SOVERSION ${_sover} + OUTPUT_NAME ${LIBNAME} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) add_library(${LIBNAME}_static STATIC $) - set_target_properties(${LIBNAME}_static PROPERTIES OUTPUT_NAME ${LIBNAME}) - - set(_libdir "${CMAKE_BINARY_DIR}/lib") - if(DEFINED ENV{DEB_HOST_MULTIARCH}) - string(APPEND _libdir "/$ENV{DEB_HOST_MULTIARCH}") - endif() - set_target_properties(${LIBNAME}_shared PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${_libdir}) - set_target_properties(${LIBNAME}_static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${_libdir}) + set_target_properties(${LIBNAME}_static PROPERTIES + OUTPUT_NAME ${LIBNAME} + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) endfunction()