This commit is contained in:
Andrei Astafev 2022-10-01 17:02:49 +03:00
parent a2a5277839
commit 8d2dbfec22

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}
@ -30,8 +32,6 @@ function(myx_install_library NAME)
COMPONENT dev COMPONENT dev
) )
get_target_property(type ${NAME} TYPE)
install(EXPORT ${NAME}Targets install(EXPORT ${NAME}Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NAME}
COMPONENT dev COMPONENT dev
@ -45,24 +45,24 @@ 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() endif()
if(TARGET ${NAME}_static) if(TARGET ${NAME}_static)
install( install(
TARGETS ${NAME}_static TARGETS ${NAME}_static
EXPORT ${NAME}Targets EXPORT ${NAME}Targets
ARCHIVE ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib
COMPONENT lib )
) endif()
endif() endif()
if(${type} STREQUAL "INTERFACE_LIBRARY") if(${type} STREQUAL "INTERFACE_LIBRARY")
@ -72,5 +72,4 @@ function(myx_install_library NAME)
COMPONENT lib COMPONENT lib
) )
endif() endif()
endfunction() endfunction()