add fix to prevent GCC compilation crashing

This commit is contained in:
2026-06-05 09:44:52 +03:00
parent d39a22fd82
commit abb2a691f3
2 changed files with 23 additions and 9 deletions

View File

@@ -6,9 +6,15 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# define explicitely GCC version to prevent redefintion by CLANG
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# add_compile_options(-fgnuc-version=${CMAKE_CXX_COMPILER_VERSION})
# endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# add_compile_options(-fgnuc-version=${CMAKE_CXX_COMPILER_VERSION})
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
list(GET VERSION_LIST 0 VER_MAJOR)
list(GET VERSION_LIST 1 VER_MINOR)
list(GET VERSION_LIST 2 VER_PATCH)
math(EXPR GCC_VER "${VER_MAJOR}*10000+${VER_MINOR}*100+${VER_PATCH}")
add_compile_definitions("GCC_VERSION=${GCC_VER}")
endif()
# for ccls
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)