FindNanopb.cmake: Add option NANOPB_GENERATE_CPP_STANDALONE (#741)

For historical reasons, FindNanopb.cmake adds the nanopb source
files to the SRCS list. Since then there have been new options
to build as a library file instead.

Setting this option to false allows to skip the nanopb source files
from the list and include only generated .pb.c files.
For backwards compatibility it is enabled by default.
diff --git a/extra/FindNanopb.cmake b/extra/FindNanopb.cmake
index 206f5e6..1237cc8 100644
--- a/extra/FindNanopb.cmake
+++ b/extra/FindNanopb.cmake
@@ -290,9 +290,18 @@
   endforeach()
 
   set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
-  set(${SRCS} ${${SRCS}} ${NANOPB_SRCS} PARENT_SCOPE)
-  set(${HDRS} ${${HDRS}} ${NANOPB_HDRS} PARENT_SCOPE)
 
+  if(NOT DEFINED NANOPB_GENERATE_CPP_STANDALONE)
+    set(NANOPB_GENERATE_CPP_STANDALONE TRUE)
+  endif()
+
+  if (NANOPB_GENERATE_CPP_STANDALONE)
+    set(${SRCS} ${${SRCS}} ${NANOPB_SRCS} PARENT_SCOPE)
+    set(${HDRS} ${${HDRS}} ${NANOPB_HDRS} PARENT_SCOPE)
+  else()
+    set(${SRCS} ${${SRCS}} PARENT_SCOPE)
+    set(${HDRS} ${${HDRS}} PARENT_SCOPE)
+  endif()
 endfunction()