Имя выходного файла для библиотеки
This commit is contained in:
parent
d28f78d521
commit
f095753fa6
@ -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 $<TARGET_OBJECTS:${LIBNAME}>)
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user