File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,21 @@ else ()
2323 option (TPDE_ENABLE_ASSERTIONS "Enable assertions" ON )
2424endif ()
2525option (TPDE_BUILD_DOCS "Build documentation" OFF )
26+ option (TPDE_ENABLE_EH "Build with exception handling" OFF )
2627
2728# warnings
2829if (MSVC )
2930 add_compile_options (/W4 /WX )
30- # disable RTTI and exceptions
31- add_compile_options (/GR- /EHsc /D_HAS_EXCEPTIONS=0 )
31+
32+ # enable/disable exceptions
33+ if (NOT TPDE_ENABLE_EH)
34+ add_compile_options (/GR- )
35+ endif ()
3236else ()
3337 add_compile_options (-Wall -Wextra -Wpedantic )
34- # disable RTTI and exceptions
35- add_compile_options ("$<$<COMPILE_LANGUAGE :CXX >:-fno -rtti ;-fno -exceptions >" )
38+ if (NOT TPDE_ENABLE_EH)
39+ add_compile_options ("$<$<COMPILE_LANGUAGE :CXX >:-fno -exceptions >" )
40+ endif ()
3641
3742 # this is annoying
3843 add_compile_options (-Wno-missing-field-initializers )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ set(TPDE_LINK_LLVM_STATIC FALSE CACHE BOOL "Should LLVM be linked statically?")
1414
1515target_include_directories (tpde_encodegen SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS} )
1616target_compile_definitions (tpde_encodegen PRIVATE ${LLVM_DEFINITIONS} )
17+ target_compile_options (tpde_encodegen PRIVATE "$<$<COMPILE_LANGUAGE :CXX >:-fno -rtti ;-fno -exceptions >" )
1718if (TPDE_LINK_LLVM_STATIC)
1819 llvm_map_components_to_libnames (TPDE_ENCODEGEN_LLVM_LIBS
1920 core X86 AArch64 CodeGen irreader irprinter passes mc support targetparser asmparser asmprinter bitreader bitstreamreader
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ set(TPDE_LINK_LLVM_STATIC FALSE CACHE BOOL "Should LLVM be linked statically?")
3030
3131target_include_directories (tpde_llvm SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} )
3232target_compile_definitions (tpde_llvm PUBLIC ${LLVM_DEFINITIONS} )
33+ if (NOT LLVM_ENABLE_RTTI)
34+ target_compile_options (tpde_llvm PUBLIC -fno-rtti )
35+ endif ()
3336if (TPDE_LINK_LLVM_STATIC)
3437 llvm_map_components_to_libnames (TPDE_LLVM_LIBS
3538 analysis core irreader irprinter jitlink orcjit passes support bitreader bitstreamreader targetparser
You can’t perform that action at this time.
0 commit comments