diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2021-07-16 23:30:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 23:30:04 +0300 |
commit | 3a68a7274022f75d1a54baebda313820010b1c9c (patch) | |
tree | 8071180119e15ee2ce7c2cc79fc9737b3141ad1f /CMakeLists.txt | |
parent | 8966cc2b2748351a04855dae6d04d3dc1606bc6e (diff) |
CMake: add ENABLE_RTTI option (#4382)
Fixes
$ CXX=clang++ cmake -H. -Bout -DSPIRV_USE_SANITIZER=vptr
$ make -C out
...
clang: error: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti'
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 356894912..84a7bb7e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ include(GNUInstallDirs) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_STANDARD 11) +option(ENABLE_RTTI "Enables RTTI" OFF) option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") @@ -178,11 +179,14 @@ function(spvtools_default_compile_options TARGET) target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS}) if (${COMPILER_IS_LIKE_GNU}) - target_compile_options(${TARGET} PRIVATE - -std=c++11 -fno-exceptions -fno-rtti) + target_compile_options(${TARGET} PRIVATE -std=c++11 -fno-exceptions) target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion) + + if(NOT ENABLE_RTTI) + add_compile_options(-fno-rtti) + endif() # For good call stacks in profiles, keep the frame pointers. if(NOT "${SPIRV_PERF}" STREQUAL "") target_compile_options(${TARGET} PRIVATE -fno-omit-frame-pointer) |