Исправлен целевой каталог для формирования библиотек

This commit is contained in:
Andrei Astafev 2020-04-22 19:06:22 +03:00
parent 83a9e94e31
commit a52a9e7b8a

View File

@ -19,21 +19,22 @@ function(add_common_library target)
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/${target}>)
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
# cmake-format: off
if(BUILD_SHARED_LIBS)
add_library(${target}_shared SHARED $<TARGET_OBJECTS:${target}>)
set_target_properties(
${target}_shared
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} OUTPUT_NAME ${OUTNAME}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR})
set_target_properties(${target}_shared PROPERTIES OUTPUT_NAME ${OUTNAME}
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${target}_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT SKIP_STATIC_LIBS)
add_library(${target}_static STATIC $<TARGET_OBJECTS:${target}>)
set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${OUTNAME} ARCHIVE_OUTPUT_DIRECTORY
${CMAKE_INSTALL_LIBDIR})
set_target_properties(${target}_static PROPERTIES OUTPUT_NAME ${OUTNAME}
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
# cmake-format: on
configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${target}.pc)
install(FILES ${CMAKE_BINARY_DIR}/${target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)