diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-01 13:01:07 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-01 13:01:07 +0800 |
| commit | b4d1ddb99e1305f6ea6217e7570dda2a94b16e51 (patch) | |
| tree | fb4501033e8d03f06511bff638e0929c4114f465 /backend/cmake/modules | |
| parent | fd8770b01a7a3ae85ba85fb43b21803c88593ad7 (diff) | |
| download | rcc-project-b4d1ddb99e1305f6ea6217e7570dda2a94b16e51.tar.gz rcc-project-b4d1ddb99e1305f6ea6217e7570dda2a94b16e51.tar.xz | |
[CMake] Match LLVM EH and RTTI defaults
Disable C++ exceptions and RTTI by default while retaining explicit, validated opt-in switches. Replace the arena's exception syntax with an RAII construction guard so both configurations share one implementation.
Diffstat (limited to 'backend/cmake/modules')
| -rw-r--r-- | backend/cmake/modules/RCCBackendBuild.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/backend/cmake/modules/RCCBackendBuild.cmake b/backend/cmake/modules/RCCBackendBuild.cmake index 79e7bb1..52e3a71 100644 --- a/backend/cmake/modules/RCCBackendBuild.cmake +++ b/backend/cmake/modules/RCCBackendBuild.cmake @@ -70,6 +70,18 @@ function(rcc_backend_configure_target Target) -Wformat=2 ) + if(RCC_BACKEND_ENABLE_EH) + target_compile_options("${Target}" PRIVATE -fexceptions) + else() + target_compile_options("${Target}" PRIVATE -fno-exceptions) + endif() + + if(RCC_BACKEND_ENABLE_RTTI) + target_compile_options("${Target}" PRIVATE -frtti) + else() + target_compile_options("${Target}" PRIVATE -fno-rtti) + endif() + if(RCC_BACKEND_WARNINGS_AS_ERRORS) target_compile_options("${Target}" PRIVATE -Werror) endif() |
