Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmake/TargetCapnpSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,13 @@ function(target_capnp_sources target include_prefix)
# dependencies of generated headers on other generated headers.
if(NOT TARGET "${target}_headers")
add_custom_target("${target}_headers" DEPENDS ${generated_headers})
else()
# target_capnp_sources can be called more than once for the same target,
# for example to add optional schemas or schemas with a different include
# prefix. Dependencies can't be added to an existing custom target, so add
# these headers through a helper target that ${target}_headers depends on.
string(MD5 headers_hash "${CMAKE_CURRENT_SOURCE_DIR};${generated_headers}")
add_custom_target("${target}_headers_${headers_hash}" DEPENDS ${generated_headers})
add_dependencies("${target}_headers" "${target}_headers_${headers_hash}")
Comment on lines +130 to +131

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: Quoting here seems unnecessary.

endif()
endfunction()
Loading