Работа с интерфейсной библиотекой в старых CMake
This commit is contained in:
parent
1ee5df29d1
commit
9333a7adfa
@ -57,18 +57,29 @@ function(myx_add_interface_library TARGET_NAME)
|
||||
endforeach()
|
||||
|
||||
if(ARG_LINK_LIBRARIES)
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE ${ARG_LINK_LIBRARIES})
|
||||
if(${CMAKE_VERSION} VERSION_GREATER "3.15.0")
|
||||
foreach(__lib ${ARG_LINK_LIBRARIES})
|
||||
if(TARGET ${__lib})
|
||||
if(${CMAKE_VERSION} VERSION_GREATER "3.15.0")
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE ${__lib})
|
||||
install(
|
||||
TARGETS ${__lib}
|
||||
EXPORT ${TARGET_NAME}Targets
|
||||
COMPONENT DEV)
|
||||
else()
|
||||
get_target_property(__target_type ${__lib} TYPE)
|
||||
if(__target_type STREQUAL "OBJECT_LIBRARY")
|
||||
if(TARGET "${__lib}_static")
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE "${__lib}_static")
|
||||
elseif(TARGET "${__lib}_shared")
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE "${__lib}_shared")
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE ${__lib})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Библиотека, состоящая только из заголовочных файлов не требует сборки.
|
||||
# Стандартные пути к заголовочным файлам
|
||||
|
Loading…
Reference in New Issue
Block a user