Skip to content

Commit b932f95

Browse files
ruslorahulshethsc
authored andcommitted
CMake: Android log library dependency
1 parent c29b22f commit b932f95

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

cmake/libprotobuf-lite.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ set_target_properties(libprotobuf-lite PROPERTIES
8383
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
8484
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
8585
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
86+
87+
if(ANDROID)
88+
find_package(android_log REQUIRED)
89+
target_link_libraries(libprotobuf-lite PUBLIC android_log::android_log)
90+
endif()

cmake/libprotobuf.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ endif()
114114

115115
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
116116
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
117-
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
117+
target_link_libraries(libprotobuf PUBLIC ${CMAKE_THREAD_LIBS_INIT})
118118
if(protobuf_WITH_ZLIB)
119-
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
119+
target_link_libraries(libprotobuf PUBLIC ${ZLIB_LIBRARIES})
120120
endif()
121121
if(protobuf_LINK_LIBATOMIC)
122122
target_link_libraries(libprotobuf atomic)
@@ -135,3 +135,8 @@ set_target_properties(libprotobuf PROPERTIES
135135
OUTPUT_NAME ${LIB_PREFIX}protobuf
136136
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
137137
add_library(protobuf::libprotobuf ALIAS libprotobuf)
138+
139+
if(ANDROID)
140+
find_package(android_log REQUIRED)
141+
target_link_libraries(libprotobuf PUBLIC android_log::android_log)
142+
endif()

cmake/protobuf-config.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,7 @@ endfunction()
150150
if(protobuf_MODULE_COMPATIBLE)
151151
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
152152
endif()
153+
154+
if(ANDROID)
155+
find_package(android_log REQUIRED)
156+
endif()

0 commit comments

Comments
 (0)