From 50c7447ea93db92bf8ea675783e962ea56326783 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Thu, 22 Sep 2022 16:48:58 -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 Differential Revision: D39707592 Pulled By: Atry fbshipit-source-id: 8c1a4251e48b8802aab1606f50a972ca945b7da2 --- thrift/lib/cpp/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/thrift/lib/cpp/CMakeLists.txt b/thrift/lib/cpp/CMakeLists.txt index 9e183be17125..faa2aa20c3ed 100644 --- a/thrift/lib/cpp/CMakeLists.txt +++ b/thrift/lib/cpp/CMakeLists.txt @@ -92,6 +92,12 @@ 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 $<$:-fsized-deallocation>) +endif() target_link_libraries( async PUBLIC