1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-04-18 17:24:03 +03:00

allow builder to customize CMAKE_CXX_STANDARD for fizz, mvfst and wangle

Summary:
In OSS build, we need to enable coroutine with gnu++20 and clang.

When we build folly with CXX standard gnu++20 and clang, it will fail to build fizz, mvfst / wangle if these project has CXX standard set to 17.

example error log:

  /usr/bin/clang++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -DWANGLE_HAVE_SSL_SESSION_DUP -Dwangle_EXPORTS -I/tmp/fbcode_builder_getdeps-ZappZfbthriftZbuildZfbcode_builder-root/repos/github.com-facebook-wangle.git/wangle/.. -isystem /usr/include/libdwarf -isystem /usr/include/libiberty -std=gnu++20 -O2 -fcoroutines-ts -I/usr/include/python3.10/ -O2 -g -DNDEBUG -fPIC -std=c++17 -MD -MT CMakeFiles/wangle.dir/acceptor/EvbHandshakeHelper.cpp.o -MF CMakeFiles/wangle.dir/acceptor/EvbHandshakeHelper.cpp.o.d -o CMakeFiles/wangle.dir/acceptor/EvbHandshakeHelper.cpp.o -c /tmp/fbcode_builder_getdeps-ZappZfbthriftZbuildZfbcode_builder-root/repos/github.com-facebook-wangle.git/wangle/acceptor/EvbHandshakeHelper.cpp
  In file included from /tmp/fbcode_builder_getdeps-ZappZfbthriftZbuildZfbcode_builder-root/repos/github.com-facebook-wangle.git/wangle/acceptor/EvbHandshakeHelper.cpp:17:
  In file included from /tmp/fbcode_builder_getdeps-ZappZfbthriftZbuildZfbcode_builder-root/repos/github.com-facebook-wangle.git/wangle/../wangle/acceptor/EvbHandshakeHelper.h:22:
  In file included from /usr/local/include/folly/io/async/AsyncSSLSocket.h:21:
  In file included from /usr/local/include/folly/Optional.h:680:
  In file included from /usr/local/include/folly/coro/Coroutine.h:40:
  /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/coroutine:334:2: error: "the coroutine   header requires -fcoroutines"
  #error "the coroutine header requires -fcoroutines"

When building with clang, it does not support flag: "-fcoroutines". It needs "-fcoroutines-ts" to enable coroutines support.

Change to not set CMAKE_CXX_STANDARD to 17 and set(CMAKE_CXX_EXTENSIONS OFF) when the CMAKE_CXX_STANDARD is provided

Reviewed By: jmswen

Differential Revision: D69486269

fbshipit-source-id: 9ef6ef173d3aba5f4490406457f62a135e7fedd0
This commit is contained in:
Xiao Li 2025-02-12 15:53:39 -08:00 committed by Facebook GitHub Bot
parent 9b44e8dac0
commit 646cec48cd

View File

@ -11,9 +11,12 @@ if (NOT DEFINED PACKAGE_VERSION)
set(PACKAGE_VERSION "0")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "setting C++ standard to C++${CMAKE_CXX_STANDARD}")
endif()
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"