Skip to content

Commit fc0041e

Browse files
Disable tree-slp-vectorize to fix build on older GCC
1 parent a404105 commit fc0041e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ if(PROJECT_IS_TOP_LEVEL)
7474
)
7575
endif()
7676

77+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
78+
# XXX: GCC 12 and 13 can compile the library, but if the `tree-slp-vectorize` optimization
79+
# is enabled, then GCC will malform certain coroutine codegen, producing linker errors. This
80+
# is enabled by -O2, so we explicitly disable this single optimization to support GCC 12/13
81+
add_compile_options(-fno-tree-slp-vectorize -Wno-unknown-pragmas)
82+
endif()
83+
7784
add_compile_options(
7885
# When compiling C++ with GCC, set a deeper diagnostics depth
7986
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<COMPILE_LANGUAGE:CXX>>:-fconcepts-diagnostics-depth=4>
@@ -83,7 +90,9 @@ add_compile_options(
8390

8491
# If we generate any DLLs, use a .dll.lib suffix for the importlibs, to distinguish
8592
# them from actual static libraries
86-
set(CMAKE_IMPORT_LIBRARY_SUFFIX .dll.lib)
93+
if(WIN32)
94+
set(CMAKE_IMPORT_LIBRARY_SUFFIX .dll.lib)
95+
endif()
8796

8897
# Debug binaries will have a `-dbg` suffix to allow multi-conf installation
8998
set(CMAKE_DEBUG_POSTFIX -dbg)

0 commit comments

Comments
 (0)