Skip to content

Commit 4801c9d

Browse files
committed
turn on RTTI for v8pp library
and turn it off only for v8pp/context.cpp on macOS, because exceptions there can't be catched if they were thrown from dylib with disabled RTTI More details in Stackoverflow quiestion ["Problems throwing and catching exceptions on OS X with -fno-rtti"](https://stackoverflow.com/questions/21737201/problems-throwing-and-catching-exceptions-on-os-x-with-fno-rtti) See issue #176
1 parent dd92367 commit 4801c9d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

v8pp/CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if(MSVC)
6060
# set warning level 3 for system headers
6161
list(APPEND V8PP_COMPILE_OPTIONS /experimental:external /external:anglebrackets /external:W3)
6262
else()
63-
set(V8PP_COMPILE_OPTIONS -fno-rtti -fexceptions -Wall -Wextra -Wpedantic)
63+
set(V8PP_COMPILE_OPTIONS -frtti -fexceptions -Wall -Wextra -Wpedantic)
6464
endif()
6565

6666
if(V8PP_HEADER_ONLY)
@@ -84,6 +84,11 @@ else()
8484
if(BUILD_SHARED_LIBS)
8585
target_link_libraries(v8pp PUBLIC ${CMAKE_DL_LIBS})
8686
endif()
87+
if(APPLE)
88+
# turn off RTTI to avoid generating typeinfo for v8::ArrayBuffer::Allocator
89+
# used in context.cpp
90+
set_source_files_properties(context.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
91+
endif()
8792
endif()
8893

8994
#source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${V8PP_HEADERS} ${V8PP_SOURCES})

0 commit comments

Comments
 (0)