diff options
author | Rich Gowman <rgowman@google.com> | 2018-02-02 14:12:51 -0500 |
---|---|---|
committer | Rich Gowman <rgowman@google.com> | 2018-02-06 10:02:30 -0500 |
commit | 3fcdf510ce4b7f50e44445ff329d9019e73ba257 (patch) | |
tree | e6d76f82d838e3d8a3ee852be40c4676a19e3552 /cmake | |
parent | 9a71ce8e677cdd1bff4c8fd21666a074d1e893b7 (diff) |
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.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindNanopb.cmake | 34 | ||||
-rw-r--r-- | cmake/external/firestore.cmake | 1 |
2 files changed, 35 insertions, 0 deletions
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. |