[librdkafka] Add vcpkg-cmake-wrapper.cmake (#8355)

* [librdkafka] Add vcpkg-cmake-wrapper.cmake

* Update changes
This commit is contained in:
Phoebe 2019-09-28 00:46:49 +08:00 committed by Curtis J Bezault
parent 77a0a4a615
commit adfa6fd359
2 changed files with 46 additions and 1 deletions

View File

@ -1,5 +1,5 @@
Source: librdkafka Source: librdkafka
Version: 1.2.0-1 Version: 1.2.0-2
Description: The Apache Kafka C/C++ library Description: The Apache Kafka C/C++ library
Homepage: https://github.com/edenhill/librdkafka Homepage: https://github.com/edenhill/librdkafka

View File

@ -0,0 +1,45 @@
include(SelectLibraryConfigurations)
list(REMOVE_ITEM ARGS "NO_MODULE")
list(REMOVE_ITEM ARGS "CONFIG")
list(REMOVE_ITEM ARGS "MODULE")
_find_package(${ARGS} CONFIG)
if(RdKafka_FOUND)
if(TARGET RdKafka::rdkafka)
set(TARGET_NAME RdKafka::rdkafka)
else(TARGET RdKafka::rdkafka++)
set(TARGET_NAME RdKafka::rdkafka++)
endif()
if(TARGET ${TARGET_NAME} AND NOT DEFINED RdKafka_INCLUDE_DIRS)
get_target_property(_RdKafka_INCLUDE_DIRS ${TARGET_NAME} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_RdKafka_LINK_LIBRARIES ${TARGET_NAME} INTERFACE_LINK_LIBRARIES)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
get_target_property(_RdKafka_LIBRARY_DEBUG ${TARGET_NAME} IMPORTED_IMPLIB_DEBUG)
get_target_property(_RdKafka_LIBRARY_RELEASE ${TARGET_NAME} IMPORTED_IMPLIB_RELEASE)
endif()
if(NOT _RdKafka_LIBRARY_DEBUG AND NOT _RdKafka_LIBRARY_RELEASE)
get_target_property(_RdKafka_LIBRARY_DEBUG ${TARGET_NAME} IMPORTED_LOCATION_DEBUG)
get_target_property(_RdKafka_LIBRARY_RELEASE ${TARGET_NAME} IMPORTED_LOCATION_RELEASE)
endif()
set(RdKafka_INCLUDE_DIR "${_RdKafka_INCLUDE_DIRS}")
set(RdKafka_LIBRARY_DEBUG "${_RdKafka_LIBRARY_DEBUG}")
set(RdKafka_LIBRARY_RELEASE "${_RdKafka_LIBRARY_RELEASE}")
select_library_configurations(RdKafka)
list(APPEND RdKafka_LIBRARIES ${_RdKafka_LINK_LIBRARIES})
list(APPEND RdKafka_LIBRARY ${_RdKafka_LINK_LIBRARIES})
unset(_RdKafka_INCLUDE_DIRS)
unset(_RdKafka_LINK_LIBRARIES)
unset(_RdKafka_LIBRARY_DEBUG)
unset(_RdKafka_LIBRARY_DEBUG)
unset(TARGET_NAME)
endif()
endif()