Выходное имя библиотеки наследуется от основной цели
This commit is contained in:
parent
c82b5f29f1
commit
530055de9d
@ -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")
|
myx_cmake_message_error("MyxCMake: myx_cmake_add_shared_library needs target of type OBJECT_LIBRARY")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_target_property(__output_name ${target} OUTPUT_NAME)
|
||||||
|
if(NOT __output_name)
|
||||||
|
set(__output_name ${target})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(${target}-shared SHARED $<TARGET_OBJECTS:${target}>)
|
add_library(${target}-shared SHARED $<TARGET_OBJECTS:${target}>)
|
||||||
set_target_properties(
|
# cmake-format: off
|
||||||
${target}-shared
|
set_target_properties(${target}-shared
|
||||||
PROPERTIES OUTPUT_NAME ${target}
|
PROPERTIES OUTPUT_NAME ${__output_name}
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
LIBRARY_OUTPUT_DIRECTORY
|
LIBRARY_OUTPUT_DIRECTORY
|
||||||
@ -21,4 +26,5 @@ function(myx_cmake_add_shared_library target)
|
|||||||
install(TARGETS ${target}-shared
|
install(TARGETS ${target}-shared
|
||||||
COMPONENT main
|
COMPONENT main
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
# cmake-format: on
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -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")
|
myx_cmake_message_error("MyxCMake: myx_cmake_add_static_library needs target of type OBJECT_LIBRARY")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_target_property(__output_name ${target} OUTPUT_NAME)
|
||||||
|
if(NOT __output_name)
|
||||||
|
set(__output_name ${target})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(${target}-static STATIC $<TARGET_OBJECTS:${target}>)
|
add_library(${target}-static STATIC $<TARGET_OBJECTS:${target}>)
|
||||||
|
# cmake-format: off
|
||||||
set_target_properties(${target}-static
|
set_target_properties(${target}-static
|
||||||
PROPERTIES
|
PROPERTIES OUTPUT_NAME ${__output_name}
|
||||||
OUTPUT_NAME ${target}
|
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
|
||||||
install(TARGETS ${target}-static
|
install(TARGETS ${target}-static
|
||||||
COMPONENT static
|
COMPONENT static
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
# cmake-format: on
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user