Skip to content

Commit

Permalink
CMake: Android log library dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo authored and rbsheth committed Aug 13, 2020
1 parent 5628d94 commit 8c9e82e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cmake/libprotobuf-lite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,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()
9 changes: 7 additions & 2 deletions cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,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()
if(protobuf_LINK_LIBATOMIC)
target_link_libraries(libprotobuf atomic)
Expand All @@ -132,3 +132,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()
4 changes: 4 additions & 0 deletions cmake/protobuf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,7 @@ endfunction()
if(protobuf_MODULE_COMPATIBLE)
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake")
endif()

if(ANDROID)
find_package(android_log REQUIRED)
endif()

0 comments on commit 8c9e82e

Please sign in to comment.