Skip to content

Commit dd67394

Browse files
ruslohjmallon
authored andcommitted
CMake: Android log library dependency
1 parent 7fc1d62 commit dd67394

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
@@ -116,9 +116,9 @@ endif()
116116

117117
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
118118
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
119-
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
119+
target_link_libraries(libprotobuf PUBLIC ${CMAKE_THREAD_LIBS_INIT})
120120
if(protobuf_WITH_ZLIB)
121-
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
121+
target_link_libraries(libprotobuf PUBLIC ${ZLIB_LIBRARIES})
122122
endif()
123123
if(protobuf_LINK_LIBATOMIC)
124124
target_link_libraries(libprotobuf atomic)
@@ -134,3 +134,8 @@ set_target_properties(libprotobuf PROPERTIES
134134
OUTPUT_NAME ${LIB_PREFIX}protobuf
135135
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
136136
add_library(protobuf::libprotobuf ALIAS libprotobuf)
137+
138+
if(ANDROID)
139+
find_package(android_log REQUIRED)
140+
target_link_libraries(libprotobuf PUBLIC android_log::android_log)
141+
endif()

cmake/protobuf-config.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,7 @@ endfunction()
125125
if(protobuf_MODULE_COMPATIBLE)
126126
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
127127
endif()
128+
129+
if(ANDROID)
130+
find_package(android_log REQUIRED)
131+
endif()

0 commit comments

Comments
 (0)