diff options
author | Hans Binderup <habi@bang-olufsen.dk> | 2023-01-03 15:08:16 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2023-01-03 15:55:59 +0300 |
commit | 22b5ad4395029d2e61cd04e2ce8f44da4c8e627a (patch) | |
tree | d3ea157350b66c867c9b113cb935782ddd4adb51 | |
parent | 32ec5264b7748d2dfed55f46811a975757d5e0ce (diff) |
Ensure generator files are updated when cached
When bumping Nanopb, while having the previous version cached, the
generator files are not correctly copied during build.
CMake copy_directory does not seem to copy the content if the directory
does already exist.
By specifying that we want to copy the content of the directory
we can avoid this issue.
Review: Add comment
-rw-r--r-- | extra/FindNanopb.cmake | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/extra/FindNanopb.cmake b/extra/FindNanopb.cmake index d2ca7d2..928c012 100644 --- a/extra/FindNanopb.cmake +++ b/extra/FindNanopb.cmake @@ -172,10 +172,13 @@ function(NANOPB_GENERATE_CPP SRCS HDRS) # same build directory with different python/protobuf versions # as the binary build directory is discarded across builds. # + # Notice: copy_directory does not copy the content if the directory already exists. + # We therefore append '/' to specify that we want to copy the content of the folder. See #847 + # add_custom_command( OUTPUT ${NANOPB_GENERATOR_EXECUTABLE} ${GENERATOR_CORE_SRC} COMMAND ${CMAKE_COMMAND} -E copy_directory - ARGS ${NANOPB_GENERATOR_SOURCE_DIR} ${GENERATOR_PATH} + ARGS ${NANOPB_GENERATOR_SOURCE_DIR}/ ${GENERATOR_PATH} VERBATIM) set(GENERATOR_CORE_PYTHON_SRC) |