Skip to content

Commit 8c9e82e

Browse files
ruslorbsheth
authored andcommitted
CMake: Android log library dependency
1 parent 5628d94 commit 8c9e82e

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
@@ -78,3 +78,8 @@ set_target_properties(libprotobuf-lite PROPERTIES
7878
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
7979
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
8080
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
81+
82+
if(ANDROID)
83+
find_package(android_log REQUIRED)
84+
target_link_libraries(libprotobuf-lite PUBLIC android_log::android_log)
85+
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)
@@ -132,3 +132,8 @@ set_target_properties(libprotobuf PROPERTIES
132132
OUTPUT_NAME ${LIB_PREFIX}protobuf
133133
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
134134
add_library(protobuf::libprotobuf ALIAS libprotobuf)
135+
136+
if(ANDROID)
137+
find_package(android_log REQUIRED)
138+
target_link_libraries(libprotobuf PUBLIC android_log::android_log)
139+
endif()

cmake/protobuf-config.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,7 @@ endfunction()
146146
if(protobuf_MODULE_COMPATIBLE)
147147
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
148148
endif()
149+
150+
if(ANDROID)
151+
find_package(android_log REQUIRED)
152+
endif()

0 commit comments

Comments
 (0)