Skip to content
Merged
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
17 changes: 11 additions & 6 deletions cmake/TargetCapnpSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Example:
function(target_capnp_sources target include_prefix)
cmake_parse_arguments(PARSE_ARGV 2
"TCS" # prefix
"" # options
"ONLY_CAPNP" # options
"" # one_value_keywords
"IMPORT_PATHS" # multi_value_keywords
)
Expand Down Expand Up @@ -85,11 +85,14 @@ function(target_capnp_sources target include_prefix)
set_source_files_properties(${capnp_file}.c++ PROPERTIES SKIP_LINTING TRUE) # Ignored before cmake 3.27
target_sources(${target} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.c++
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-client.c++
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-server.c++
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-types.c++
)

if(NOT TCS_ONLY_CAPNP)
target_sources(${target} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-client.c++
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-server.c++
${CMAKE_CURRENT_BINARY_DIR}/${capnp_file}.proxy-types.c++
)
endif()
list(APPEND generated_headers ${capnp_file}.h)
endforeach()

Expand All @@ -111,5 +114,7 @@ function(target_capnp_sources target include_prefix)
# dependencies explicitly because while cmake detect dependencies of non
# generated files on generated headers, it does not reliably detect
# dependencies of generated headers on other generated headers.
add_custom_target("${target}_headers" DEPENDS ${generated_headers})
if(NOT TARGET "${target}_headers")
add_custom_target("${target}_headers" DEPENDS ${generated_headers})
endif()
Comment on lines -114 to +119
Copy link
Member

Choose a reason for hiding this comment

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

These changes are reasonable on their own. Maybe split them into a separate commit?

nit: I don’t think quoting is needed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These changes are reasonable on their own. Maybe split them into a separate commit?

nit: I don’t think quoting is needed here.

These are good suggestions. Just to save effort I will leave this as-is for now but would welcome a followup to make quoting more consistent. I am a little confused by quoting rules in cmake, and am not sure if for example maybe quotes would be added around generated_headers if generated filenames could contain spaces.

endfunction()
Loading