From 530055de9dd42e289e3066f753aeacae7972a533 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 29 Dec 2021 12:50:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D1=85=D0=BE=D0=B4=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=B8=D0=BC=D1=8F=20=D0=B1=D0=B8=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D0=BE=D1=82=D0=B5=D0=BA=D0=B8=20=D0=BD=D0=B0=D1=81=D0=BB=D0=B5?= =?UTF-8?q?=D0=B4=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D0=BE=D1=82=20=D0=BE?= =?UTF-8?q?=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=86=D0=B5=D0=BB?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake | 12 +++++++++--- MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake | 13 +++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake b/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake index 8f85f89..6ccb9a4 100644 --- a/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake +++ b/MyxCMake/modules/MyxCMakeAddSharedLibrary.cmake @@ -10,10 +10,15 @@ function(myx_cmake_add_shared_library target) myx_cmake_message_error("MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY") endif() + get_target_property(__output_name ${target} OUTPUT_NAME) + if(NOT __output_name) + set(__output_name ${target}) + endif() + add_library(${target}-shared SHARED $) - set_target_properties( - ${target}-shared - PROPERTIES OUTPUT_NAME ${target} + # cmake-format: off + set_target_properties(${target}-shared + PROPERTIES OUTPUT_NAME ${__output_name} VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} LIBRARY_OUTPUT_DIRECTORY @@ -21,4 +26,5 @@ function(myx_cmake_add_shared_library target) install(TARGETS ${target}-shared COMPONENT main LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + # cmake-format: on endfunction() diff --git a/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake b/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake index f41a436..1c619a9 100644 --- a/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake +++ b/MyxCMake/modules/MyxCMakeAddStaticLibrary.cmake @@ -10,13 +10,18 @@ function(myx_cmake_add_static_library target) myx_cmake_message_error("MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY") endif() + get_target_property(__output_name ${target} OUTPUT_NAME) + if(NOT __output_name) + set(__output_name ${target}) + endif() + add_library(${target}-static STATIC $) + # cmake-format: off set_target_properties(${target}-static - PROPERTIES - OUTPUT_NAME ${target} - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) + PROPERTIES OUTPUT_NAME ${__output_name} + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) install(TARGETS ${target}-static COMPONENT static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - + # cmake-format: on endfunction()