File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,16 @@ include("cmake/compat_config.cmake")
3030include ("cmake/pthread_checks.cmake" )
3131include (GNUInstallDirs)
3232
33- # Set convenience variables for subdirectories.
34- set (MP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" )
33+ # Set MP_INCLUDE_DIR as a global property so target_capnp_sources function can
34+ # use it, and its callers don't need to specify the include directory manually
35+ # to avoid "error: Import failed: /mp/proxy.capnp" failures from capnproto.
36+ set_property (GLOBAL PROPERTY MP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" )
37+
38+ # Set a convenience variable for subdirectories.
3539if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
3640 set (MP_STANDALONE TRUE )
3741 include (CTest)
3842else ()
39- # Set MP_INCLUDE_DIR for parent directories too, so target_capnp_sources calls
40- # in parent directories can use it and not need to specify include directories
41- # manually or see capnproto error "error: Import failed: /mp/proxy.capnp"
42- set (MP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" PARENT_SCOPE)
4343 set (MP_STANDALONE FALSE )
4444endif ()
4545
Original file line number Diff line number Diff line change @@ -72,11 +72,12 @@ function(target_capnp_sources target include_prefix)
7272 message (FATAL_ERROR "No usable mpgen. Set MPGEN_EXECUTABLE or enable the internal target." )
7373 endif ()
7474
75+ get_property (mp_include_dir GLOBAL PROPERTY MP_INCLUDE_DIR)
7576 set (generated_headers "" )
7677 foreach (capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS)
7778 add_custom_command (
7879 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
79- COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR} /${capnp_file} ${TCS_IMPORT_PATHS} ${MP_INCLUDE_DIR }
80+ COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR} /${capnp_file} ${TCS_IMPORT_PATHS} ${mp_include_dir }
8081 DEPENDS ${capnp_file}
8182 VERBATIM
8283 )
@@ -97,7 +98,7 @@ function(target_capnp_sources target include_prefix)
9798 if (relative_path)
9899 string (APPEND build_include_prefix "/" "${relative_path} " )
99100 endif ()
100- target_include_directories (${target} PUBLIC $<BUILD_INTERFACE:${build_include_prefix} > ${MP_INCLUDE_DIR } )
101+ target_include_directories (${target} PUBLIC $<BUILD_INTERFACE:${build_include_prefix} > ${mp_include_dir } )
101102
102103 if (TARGET Libmultiprocess::multiprocess)
103104 target_link_libraries (${target} PRIVATE Libmultiprocess::multiprocess)
You can’t perform that action at this time.
0 commit comments