From 10b0fb209bc504998b5c88dc5e87e3b51692530a Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Fri, 23 Sep 2022 16:26:43 -0700 Subject: [PATCH] Add -fsized-deallocation compile option (#9218) Summary: Fb-thrift uses C++17's `operator delete`, which requires `-fsized-deallocation` when building c++ source code with clang and libstdc++. https://github.com/facebook/hhvm/blob/9832791642981d582d0f29c6d89dba2c879cc43d/third-party/thrift/src/thrift/lib/cpp/ContextStack.cpp#L229-L230 X-link: https://github.com/facebook/hhvm/pull/9218 Reviewed By: vitaut Differential Revision: D39707592 Pulled By: Atry fbshipit-source-id: 46e82a2d16ce095ac60b73396a8baa1d54bc57c9 --- thrift/lib/cpp/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/thrift/lib/cpp/CMakeLists.txt b/thrift/lib/cpp/CMakeLists.txt index 9e183be1712..678ce38b41b 100644 --- a/thrift/lib/cpp/CMakeLists.txt +++ b/thrift/lib/cpp/CMakeLists.txt @@ -92,6 +92,16 @@ add_library( async/TUnframedAsyncChannel.cpp server/TServerObserver.cpp ) +if ( + CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" +) + target_compile_options( + async + PUBLIC + $<$:-fsized-deallocation> + ) +endif() target_link_libraries( async PUBLIC