Skip to content

Commit 3631ded

Browse files
committed
[orc-rt] Ensure EH/RTTI=On overrides LLVM opts, applies to unit tests.
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 fa79e0a commit 3631ded

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ endif ()
99

1010
function(add_orc_rt_unittest test_dirname)
1111
add_unittest(OrcRTUnitTests ${test_dirname} ${ARGN})
12+
13+
# Apply ORC_RT_COMPILE_FLAGS to the unittest target
14+
target_compile_options(${test_dirname} PRIVATE ${ORC_RT_COMPILE_FLAGS})
1215
endfunction()
1316

1417
add_orc_rt_unittest(CoreTests

0 commit comments

Comments
 (0)