iamandi / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

cmake generates circular dependencies #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if it's a bug in my cmake (Ubuntu 2.8.7 and 2.8.9), but it ends up 
generating makefiles where message.pb.c depends on message.pb.c

Changing the custom command depends to use the full path of message.pb files 
fixes it.

diff --git a/cmake/FindNanopb.cmake b/cmake/FindNanopb.cmake
index 9678fb1..ad96b5c 100644
--- a/cmake/FindNanopb.cmake
+++ b/cmake/FindNanopb.cmake
@@ -148,7 +148,7 @@ function(NANOPB_GENERATE_CPP SRCS HDRS)
              "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
       COMMAND python
       ARGS ${NANOPB_GENERATOR_EXECUTABLE} ${FIL_WE}.pb
-      DEPENDS ${FIL_WE}.pb
+      DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb"
       COMMENT "Running nanopb generator on ${FIL_WE}.pb"
       VERBATIM )
   endforeach()

Original issue reported on code.google.com by mcbr.le...@gmail.com on 11 Nov 2013 at 1:08

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 171d64734a34.

Original comment by Petteri.Aimonen on 11 Nov 2013 at 7:23

GoogleCodeExporter commented 9 years ago
Thanks, I merged the patch. I don't use cmake myself, but the change seems 
sensible and if it works for you, it'll probably help someone else also :)

Original comment by Petteri.Aimonen on 11 Nov 2013 at 7:25

GoogleCodeExporter commented 9 years ago
Fix released in nanopb-0.2.5

Original comment by Petteri.Aimonen on 1 Jan 2014 at 9:56