From b556e42e20b13f76a6878b5bd2ade19b886d16e9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 12 Feb 2020 16:05:14 +0800 Subject: [PATCH] cmake: disable concepts in boost::asio GCC-10 and Clang choke when compiling a concept constrained with its template parameter, which is in turn another concept. as a workaround of the bug of boost::asio, we should disable concepts support in it. but it's nice to enable it when the compiler is able to use concepts to do some compile time checkings even the concepts are not compliant to C++20. Signed-off-by: Kefu Chai --- src/crimson/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/crimson/CMakeLists.txt b/src/crimson/CMakeLists.txt index 3d2ffc066ef..9ead32b9c74 100644 --- a/src/crimson/CMakeLists.txt +++ b/src/crimson/CMakeLists.txt @@ -1,6 +1,13 @@ add_library(crimson::cflags INTERFACE IMPORTED) +set(crimson_cflag_definitions "WITH_SEASTAR=1") +# disable concepts to address https://github.com/boostorg/asio/issues/312 +if((CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10) OR + (CMAKE_CXX_COMPILER_ID STREQUAL Clang)) + list(APPEND crimson_cflag_definitions + "BOOST_ASIO_DISABLE_CONCEPTS") +endif() set_target_properties(crimson::cflags PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "WITH_SEASTAR=1" + INTERFACE_COMPILE_DEFINITIONS "${crimson_cflag_definitions}" INTERFACE_LINK_LIBRARIES Seastar::seastar) set(crimson_common_srcs -- 2.39.5