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")
30
30
include ("cmake/pthread_checks.cmake" )
31
31
include (GNUInstallDirs )
32
32
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.
35
39
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
36
40
set (MP_STANDALONE TRUE )
37
41
include (CTest )
38
42
else ()
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 )
43
43
set (MP_STANDALONE FALSE )
44
44
endif ()
45
45
Original file line number Diff line number Diff line change @@ -72,11 +72,12 @@ function(target_capnp_sources target include_prefix)
72
72
message (FATAL_ERROR "No usable mpgen. Set MPGEN_EXECUTABLE or enable the internal target." )
73
73
endif ()
74
74
75
+ get_property (mp_include_dir GLOBAL PROPERTY MP_INCLUDE_DIR )
75
76
set (generated_headers "" )
76
77
foreach (capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS )
77
78
add_custom_command (
78
79
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 }
80
81
DEPENDS ${capnp_file}
81
82
VERBATIM
82
83
)
@@ -97,7 +98,7 @@ function(target_capnp_sources target include_prefix)
97
98
if (relative_path )
98
99
string (APPEND build_include_prefix "/" "${relative_path} " )
99
100
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 } )
101
102
102
103
if (TARGET Libmultiprocess::multiprocess )
103
104
target_link_libraries (${target} PRIVATE Libmultiprocess::multiprocess )
You can’t perform that action at this time.
0 commit comments