Skip to content

Commit ca81d7c

Browse files
authored
[orc-rt] Ensure EH/RTTI=On overrides LLVM opts, applies to unit tests. (#172155)
When -DORC_RT_ENABLE_EXCEPTIONS=On and -DORC_RT_ENABLE_RTTI=On are passed we need to ensure that the resulting compiler flags (e.g. -fexceptions, -frtti for clang/GCC) are appended so that we override any inherited options (e.g. -fno-exceptions, -fno-rtti) from LLVM. Updates unit tests to ensure that these compiler options are applied to them too.
1 parent 21a25f4 commit ca81d7c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

orc-rt/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ set(ORC_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
4444

4545
# Configure RTTI and exceptions compile flags
4646
set(ORC_RT_COMPILE_FLAGS)
47-
if(NOT ORC_RT_ENABLE_RTTI)
47+
if(ORC_RT_ENABLE_RTTI)
48+
list(APPEND ORC_RT_COMPILE_FLAGS -frtti)
49+
else()
4850
list(APPEND ORC_RT_COMPILE_FLAGS -fno-rtti)
4951
endif()
5052

51-
if(NOT ORC_RT_ENABLE_EXCEPTIONS)
53+
if(ORC_RT_ENABLE_EXCEPTIONS)
54+
list(APPEND ORC_RT_COMPILE_FLAGS -fexceptions)
55+
else()
5256
list(APPEND ORC_RT_COMPILE_FLAGS -fno-exceptions)
5357
endif()
5458

orc-rt/unittests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ add_orc_rt_unittest(CoreTests
3939
span-test.cpp
4040
DISABLE_LLVM_LINK_LLVM_DYLIB
4141
)
42+
target_compile_options(CoreTests PRIVATE ${ORC_RT_COMPILE_FLAGS})
4243
target_link_libraries(CoreTests PRIVATE orc-rt-executor)

0 commit comments

Comments
 (0)