File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ if(Libmultiprocess_ENABLE_CLANG_TIDY)
22
22
set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE} " )
23
23
endif ()
24
24
25
+ set (EXTERNAL_MPGEN "" CACHE STRING "Use the supplied mpgen binary rather than the one built internally" )
26
+
25
27
include ("cmake/compat_config.cmake" )
26
28
include ("cmake/pthread_checks.cmake" )
27
29
include (GNUInstallDirs )
Original file line number Diff line number Diff line change @@ -60,15 +60,23 @@ function(target_capnp_sources target include_prefix)
60
60
"IMPORT_PATHS" # multi_value_keywords
61
61
)
62
62
63
- if (NOT TARGET Libmultiprocess::mpgen )
64
- message (FATAL_ERROR "Target 'Libmultiprocess::mpgen' does not exist." )
63
+ set (MPGEN_BINARY "" )
64
+ if (EXTERNAL_MPGEN )
65
+ set (MPGEN_BINARY "${EXTERNAL_MPGEN} " )
66
+ if (NOT EXISTS "${MPGEN_BINARY} " )
67
+ message (FATAL_ERROR "EXTERNAL_MPGEN: \" ${MPGEN_BINARY} \" does not exist." )
68
+ endif ()
69
+ elseif (TARGET Libmultiprocess::multiprocess )
70
+ set (MPGEN_BINARY $< TARGET_FILE:Libmultiprocess::mpgen> )
71
+ else ()
72
+ message (FATAL_ERROR "No usable mpgen. Set EXTERNAL_MPGEN or enable the internal target." )
65
73
endif ()
66
74
67
75
set (generated_headers "" )
68
76
foreach (capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS )
69
77
add_custom_command (
70
78
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
71
- COMMAND Libmultiprocess::mpgen ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR} /${capnp_file} ${TCS_IMPORT_PATHS} ${MP_INCLUDE_DIR}
79
+ COMMAND ${MPGEN_BINARY} ${CMAKE_CURRENT_SOURCE_DIR} ${include_prefix} ${CMAKE_CURRENT_SOURCE_DIR} /${capnp_file} ${TCS_IMPORT_PATHS} ${MP_INCLUDE_DIR}
72
80
DEPENDS ${capnp_file}
73
81
VERBATIM
74
82
)
You can’t perform that action at this time.
0 commit comments