diff --git a/CMLibCommonLibraryTarget.cmake b/CMLibCommonLibraryTarget.cmake index 9100e0c..4b26394 100644 --- a/CMLibCommonLibraryTarget.cmake +++ b/CMLibCommonLibraryTarget.cmake @@ -1,13 +1,19 @@ # Создание статической и динамической библиотеки из одинаковых объектных файлов function(add_common_library) set(options) - set(oneValueArgs TARGET) + set(oneValueArgs TARGET OUTPUT_NAME) set(multiValueArgs SOURCES) cmake_parse_arguments(_LOCAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(LIBNAME ${_LOCAL_TARGET}) set(SOURCES ${_LOCAL_SOURCES}) + if (${_LOCAL_OUTPUT_NAME}) + set(OUTNAME ${_LOCAL_OUTPUT_NAME}) + else() + set(OUTNAME ${LIBNAME}) + endif() + add_library(${LIBNAME} OBJECT ${SOURCES}) target_include_directories( ${LIBNAME} @@ -22,7 +28,7 @@ function(add_common_library) PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} - OUTPUT_NAME ${LIBNAME} + OUTPUT_NAME ${OUTNAME} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) install(TARGETS ${LIBNAME}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() @@ -31,7 +37,7 @@ function(add_common_library) add_library(${LIBNAME}_static STATIC $) set_target_properties(${LIBNAME}_static PROPERTIES - OUTPUT_NAME ${LIBNAME} + OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}) install(TARGETS ${LIBNAME}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif()