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)
2222 set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE} " )
2323endif ()
2424
25+ set (EXTERNAL_MPGEN "" CACHE STRING "Use the supplied mpgen binary rather than the one built internally" )
26+
2527include ("cmake/compat_config.cmake" )
2628include ("cmake/pthread_checks.cmake" )
2729include (GNUInstallDirs)
Original file line number Diff line number Diff line change @@ -60,15 +60,23 @@ function(target_capnp_sources target include_prefix)
6060 "IMPORT_PATHS" # multi_value_keywords
6161 )
6262
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." )
6573 endif ()
6674
6775 set (generated_headers "" )
6876 foreach (capnp_file IN LISTS TCS_UNPARSED_ARGUMENTS)
6977 add_custom_command (
7078 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}
7280 DEPENDS ${capnp_file}
7381 VERBATIM
7482 )
You can’t perform that action at this time.
0 commit comments