Repository navigation
cmake: Pass installed include dir to mpgen #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -78,11 +78,15 @@ function(target_capnp_sources target include_prefix) | |||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| get_property(mp_include_dir GLOBAL PROPERTY MP_INCLUDE_DIR) | ||||||||||||||||||||||||||||||||
| set(mpgen_import_paths ${mp_include_dir}) | ||||||||||||||||||||||||||||||||
| if(NOT mp_include_dir AND MPGEN_BINARY STREQUAL "Libmultiprocess::mpgen") | ||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In commit "cmake: Pass installed include dir to mpgen" (7239a97) This fixes the case reported in #134, but |
||||||||||||||||||||||||||||||||
| get_property(mpgen_import_paths TARGET Libmultiprocess::mpgen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) | ||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In commit "cmake: Pass installed include dir to mpgen" (7239a97) Note for reviewers: for the imported target this property comes from |
||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||
|
Comment on lines
80
to
+84
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In commit "cmake: Pass installed include dir to mpgen" (7239a97) Suggestion (non-blocking): it wasn't obvious to me that an empty
Suggested change
|
||||||||||||||||||||||||||||||||
| set(generated_headers "") | ||||||||||||||||||||||||||||||||
| foreach(capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS) | ||||||||||||||||||||||||||||||||
| add_custom_command( | ||||||||||||||||||||||||||||||||
| OUTPUT ${capnp_file}.c++ ${capnp_file}.h ${capnp_file}.proxy-client.c++ ${capnp_file}.proxy-types.h ${capnp_file}.proxy-server.c++ ${capnp_file}.proxy-types.c++ ${capnp_file}.proxy.h | ||||||||||||||||||||||||||||||||
| COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_file} ${TCS_IMPORT_PATHS} ${mp_include_dir} | ||||||||||||||||||||||||||||||||
| COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR}/${capnp_file} ${TCS_IMPORT_PATHS} ${mpgen_import_paths} | ||||||||||||||||||||||||||||||||
| DEPENDS ${capnp_file} ${MPGEN_BINARY} | ||||||||||||||||||||||||||||||||
| VERBATIM | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "cmake: Pass installed include dir to mpgen" (7239a97)
I'm ok with the current approach, but an alternative that seems cleaner if it works would be for the package config to set
MP_INCLUDE_DIRitself. ThenMP_INCLUDE_DIRwould always be the directory containingmp/proxy.capnp, the include directory would be worked out where the package is found, andtarget_capnp_sourceswouldn't need a special case for installed packages. Something like this at the end ofConfig.cmake.in, after the loop that includes the targets files:(or
PATH_VARS CMAKE_INSTALL_INCLUDEDIRinconfigure_package_config_fileand@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@). It needs to be conditional onBin, notLib, because Bitcoin Core cross builds find the two components in different prefixes andproxy.capnpis installed withBin. I haven't tried this, so there may be a reason it doesn't work, in which case the current approach is fine.