Работа с интерфейсной библиотекой в старых CMake
This commit is contained in:
parent
1ee5df29d1
commit
9333a7adfa
@ -57,17 +57,28 @@ function(myx_add_interface_library TARGET_NAME)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(ARG_LINK_LIBRARIES)
|
if(ARG_LINK_LIBRARIES)
|
||||||
target_link_libraries(${TARGET_NAME} INTERFACE ${ARG_LINK_LIBRARIES})
|
foreach(__lib ${ARG_LINK_LIBRARIES})
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER "3.15.0")
|
if(TARGET ${__lib})
|
||||||
foreach(__lib ${ARG_LINK_LIBRARIES})
|
if(${CMAKE_VERSION} VERSION_GREATER "3.15.0")
|
||||||
if(TARGET ${__lib})
|
target_link_libraries(${TARGET_NAME} INTERFACE ${__lib})
|
||||||
install(
|
install(
|
||||||
TARGETS ${__lib}
|
TARGETS ${__lib}
|
||||||
EXPORT ${TARGET_NAME}Targets
|
EXPORT ${TARGET_NAME}Targets
|
||||||
COMPONENT DEV)
|
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()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Библиотека, состоящая только из заголовочных файлов не требует сборки.
|
# Библиотека, состоящая только из заголовочных файлов не требует сборки.
|
||||||
|
Loading…
Reference in New Issue
Block a user