From 3fcdf510ce4b7f50e44445ff329d9019e73ba257 Mon Sep 17 00:00:00 2001 From: Rich Gowman Date: Fri, 2 Feb 2018 14:12:51 -0500 Subject: Hook up nanopb to firestorep project Use remote/serializer placeholder class as a hook for the test to ensure nanopb headers can be found, and test can be linked. --- cmake/FindNanopb.cmake | 34 ++++++++++++++++++++++++++++++++++ cmake/external/firestore.cmake | 1 + 2 files changed, 35 insertions(+) create mode 100644 cmake/FindNanopb.cmake (limited to 'cmake') diff --git a/cmake/FindNanopb.cmake b/cmake/FindNanopb.cmake new file mode 100644 index 0000000..fab6f4a --- /dev/null +++ b/cmake/FindNanopb.cmake @@ -0,0 +1,34 @@ +include(FindPackageHandleStandardArgs) + +set(BINARY_DIR ${FIREBASE_INSTALL_DIR}/external/nanopb) + +find_path( + NANOPB_INCLUDE_DIR pb.h + HINTS ${BINARY_DIR}/src/nanopb +) + +find_library( + NANOPB_LIBRARY + NAMES protobuf-nanopb protobuf-nanopbd + HINTS ${BINARY_DIR}/src/nanopb-build +) + +find_package_handle_standard_args( + nanopb + DEFAULT_MSG + NANOPB_INCLUDE_DIR + NANOPB_LIBRARY +) + +if(NANOPB_FOUND) + set(NANOPB_INCLUDE_DIRS ${NANOPB_INCLUDE_DIR} ) + + if (NOT TARGET nanopb) + add_library(nanopb UNKNOWN IMPORTED) + set_target_properties( + nanopb PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${NANOPB_INCLUDE_DIRS} + IMPORTED_LOCATION ${NANOPB_LIBRARY} + ) + endif() +endif(NANOPB_FOUND) diff --git a/cmake/external/firestore.cmake b/cmake/external/firestore.cmake index 1a89435..94f7cae 100644 --- a/cmake/external/firestore.cmake +++ b/cmake/external/firestore.cmake @@ -21,6 +21,7 @@ ExternalProject_Add( googletest leveldb grpc + nanopb # Lay the binary directory out as if this were a subproject. This makes it # possible to build and test in it directly. -- cgit v1.2.3