Skip to content

Commit ee5e284

Browse files
committed
cmake: check for Cap'n Proto / Clang / C++20 incompatibility
Cap'n Proto 0.9.x and 0.10.x are incompatible with Clang 16+ when using C++20 due to P2468R2 implementation. This was fixed in Cap'n Proto 1.0+. Generate a helpful error when these combinations are detected. See: #199
1 parent 1b8d4a6 commit ee5e284

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ if(CapnProto_VERSION STREQUAL "0.7.0"
3636
")
3737
endif()
3838

39+
# Check for Cap'n Proto / Clang / C++20 incompatibility
40+
# Cap'n Proto 0.9.x and 0.10.x are incompatible with Clang 16+ when using C++20
41+
# due to P2468R2 implementation. This was fixed in Cap'n Proto 1.0+.
42+
# See: https://github.com/bitcoin-core/libmultiprocess/issues/199
43+
if((CapnProto_VERSION VERSION_GREATER_EQUAL "0.9.0") AND
44+
(CapnProto_VERSION VERSION_LESS "1.0.0") AND
45+
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND
46+
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16") AND
47+
(CMAKE_CXX_STANDARD EQUAL 20))
48+
message(FATAL_ERROR
49+
"Cap'n Proto ${CapnProto_VERSION} is incompatible with Clang ${CMAKE_CXX_COMPILER_VERSION} when using C++20.\n"
50+
"To resolve this issue, choose one of the following:\n"
51+
" 1. Upgrade to Cap'n Proto version 1.0 or newer (recommended)\n"
52+
" 2. Downgrade to Cap'n Proto version 0.8 or earlier\n"
53+
" 3. Use GCC instead of Clang\n"
54+
" 4. For Bitcoin Core compilation build with -DENABLE_IPC=OFF to disable multiprocess support\n"
55+
)
56+
endif()
57+
3958
set(MPGEN_EXECUTABLE "" CACHE FILEPATH "If specified, should be full path to an external mpgen binary to use rather than the one built internally.")
4059

4160
option(MP_ENABLE_CLANG_TIDY "Run clang-tidy with the compiler." OFF)

0 commit comments

Comments
 (0)