diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake index 1d0b0b848a5a9..a4009fc940137 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -68,3 +68,8 @@ set_target_properties(libprotobuf-lite PROPERTIES OUTPUT_NAME ${LIB_PREFIX}protobuf-lite DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) + +if(ANDROID) + find_package(android_log REQUIRED) + target_link_libraries(libprotobuf-lite PUBLIC android_log::android_log) +endif() diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake index bd570be7d924d..cdea1efd86328 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -120,9 +120,9 @@ endif() add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files}) -target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(libprotobuf PUBLIC ${CMAKE_THREAD_LIBS_INIT}) if(protobuf_WITH_ZLIB) - target_link_libraries(libprotobuf ${ZLIB_LIBRARIES}) + target_link_libraries(libprotobuf PUBLIC ${ZLIB_LIBRARIES}) endif() target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) @@ -135,3 +135,8 @@ set_target_properties(libprotobuf PROPERTIES OUTPUT_NAME ${LIB_PREFIX}protobuf DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") add_library(protobuf::libprotobuf ALIAS libprotobuf) + +if(ANDROID) + find_package(android_log REQUIRED) + target_link_libraries(libprotobuf PUBLIC android_log::android_log) +endif() diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in index acedcc7ae2336..ddde510f13d69 100644 --- a/cmake/protobuf-config.cmake.in +++ b/cmake/protobuf-config.cmake.in @@ -119,3 +119,7 @@ endfunction() if(protobuf_MODULE_COMPATIBLE) include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake") endif() + +if(ANDROID) + find_package(android_log REQUIRED) +endif()