aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/FindNanopb.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindNanopb.cmake')
-rw-r--r--cmake/FindNanopb.cmake34
1 files changed, 34 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)