Обновление

This commit is contained in:
Andrei Astafev 2022-10-01 17:02:15 +03:00
parent 547ed6d0f1
commit d61dde9ed2

View File

@ -11,6 +11,8 @@ function(myx_install_library NAME)
return() return()
endif() endif()
get_target_property(type ${NAME} TYPE)
write_basic_package_version_file( write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${NAME}ConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/${NAME}ConfigVersion.cmake
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
@ -43,22 +45,30 @@ function(myx_install_library NAME)
COMPONENT dev COMPONENT dev
) )
if(TARGET ${NAME}_shared) if(${type} STREQUAL "OBJECT_LIBRARY")
install( if(TARGET ${NAME}_shared)
TARGETS ${NAME}_shared install(
EXPORT ${NAME}Targets TARGETS ${NAME}_shared
LIBRARY EXPORT ${NAME}Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib COMPONENT lib
) )
endif()
if(TARGET ${NAME}_static)
install(
TARGETS ${NAME}_static
EXPORT ${NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib
)
endif()
endif() endif()
if(TARGET ${NAME}_static) if(${type} STREQUAL "INTERFACE_LIBRARY")
install( install(
TARGETS ${NAME}_static TARGETS ${NAME}
EXPORT ${NAME}Targets EXPORT ${NAME}Targets
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT lib COMPONENT lib
) )
endif() endif()