diff --git a/README.md b/README.md index 91e7be2c0..6a3e256ac 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ On command line: * `-DBUILD_TESTING=OFF` disables building of tests. * `-DBUILD_EXAMPLES=OFF` disables building of examples. * `-DBUILD_DOCS=ON` enables building of API docs. + * `-DFAIRMQ_CHANNEL_DEFAULT_AUTOBIND=OFF` disable channel `autoBind` by default * You can hint non-system installations for dependent packages, see the #installation-from-source section above After the `find_package(FairMQ)` call the following CMake variables are defined: diff --git a/cmake/FairMQSummary.cmake b/cmake/FairMQSummary.cmake index af55ac75d..68eab32cc 100644 --- a/cmake/FairMQSummary.cmake +++ b/cmake/FairMQSummary.cmake @@ -96,7 +96,10 @@ endmacro() macro(fairmq_summary_compile_definitions) message(STATUS " ") - message(STATUS " ${Cyan}COMPILE DEFINITION VALUE${CR}") - message(STATUS " ${BWhite}FAIRMQ_HAS_STD_FILESYSTEM${CR} ${FAIRMQ_HAS_STD_FILESYSTEM} (overridable with ${BMagenta}-DFAIRMQ_HAS_STD_FILESYSTEM=0|1${CR})") - message(STATUS " ${BWhite}FAIRMQ_HAS_STD_PMR${CR} ${FAIRMQ_HAS_STD_PMR} (overridable with ${BMagenta}-DFAIRMQ_HAS_STD_PMR=0|1${CR})") + message(STATUS " ${Cyan}COMPILE DEFINITION VALUE${CR}") + message(STATUS " ${BWhite}FAIRMQ_HAS_STD_FILESYSTEM${CR} ${FAIRMQ_HAS_STD_FILESYSTEM} (overridable with ${BMagenta}-DFAIRMQ_HAS_STD_FILESYSTEM=0|1${CR})") + message(STATUS " ${BWhite}FAIRMQ_HAS_STD_PMR${CR} ${FAIRMQ_HAS_STD_PMR} (overridable with ${BMagenta}-DFAIRMQ_HAS_STD_PMR=0|1${CR})") + if(DEFINED FAIRMQ_CHANNEL_DEFAULT_AUTOBIND) + message(STATUS " ${BWhite}FAIRMQ_CHANNEL_DEFAULT_AUTOBIND${CR} ${FAIRMQ_CHANNEL_DEFAULT_AUTOBIND}") + endif() endmacro() diff --git a/fairmq/CMakeLists.txt b/fairmq/CMakeLists.txt index 491bca872..c21399c5c 100644 --- a/fairmq/CMakeLists.txt +++ b/fairmq/CMakeLists.txt @@ -174,6 +174,15 @@ if(BUILD_FAIRMQ) FAIRMQ_HAS_STD_FILESYSTEM=${FAIRMQ_HAS_STD_FILESYSTEM} FAIRMQ_HAS_STD_PMR=${FAIRMQ_HAS_STD_PMR} ) + if(DEFINED FAIRMQ_CHANNEL_DEFAULT_AUTOBIND) + # translate CMake boolean (TRUE, FALSE, 0, 1, OFF, ON) into C++ boolean literal (true, false) + if(FAIRMQ_CHANNEL_DEFAULT_AUTOBIND) + set(value "true") + else() + set(value "false") + endif() + target_compile_definitions(${target} PUBLIC FAIRMQ_CHANNEL_DEFAULT_AUTOBIND=${value}) + endif() ####################### diff --git a/fairmq/Channel.h b/fairmq/Channel.h index f21c35003..1de8bf4ef 100644 --- a/fairmq/Channel.h +++ b/fairmq/Channel.h @@ -379,7 +379,11 @@ class Channel static constexpr int DefaultRateLogging = 1; static constexpr int DefaultPortRangeMin = 22000; static constexpr int DefaultPortRangeMax = 23000; +#ifdef FAIRMQ_CHANNEL_DEFAULT_AUTOBIND + static constexpr bool DefaultAutoBind = FAIRMQ_CHANNEL_DEFAULT_AUTOBIND; +#else static constexpr bool DefaultAutoBind = true; +#endif friend std::ostream& operator<<(std::ostream& os, const Channel& ch) {