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 committed Feb 11, 2019
1 parent ad15aac commit 90eacfa
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 @@ -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()
9 changes: 7 additions & 2 deletions cmake/libprotobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
4 changes: 4 additions & 0 deletions cmake/protobuf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 90eacfa

Please sign in to comment.