Skip to content

Commit

Permalink
make compile options public for v8pp CMake target
Browse files Browse the repository at this point in the history
Set alos explicit `-fexceptions` flag for `v8pp` target.

See issue #176
  • Loading branch information
pmed committed Nov 2, 2021
1 parent 62d9fb8 commit 6611145
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v8pp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if(MSVC)
# set warning level 3 for system headers
list(APPEND V8PP_COMPILE_OPTIONS /experimental:external /external:anglebrackets /external:W3)
else()
set(V8PP_COMPILE_OPTIONS -fno-rtti -Wall -Wextra -Wpedantic)
set(V8PP_COMPILE_OPTIONS -fno-rtti -fexceptions -Wall -Wextra -Wpedantic)
endif()

if(V8PP_HEADER_ONLY)
Expand All @@ -70,7 +70,7 @@ if(V8PP_HEADER_ONLY)
else()
add_library(v8pp ${V8PP_HEADERS} ${V8PP_SOURCES})
target_compile_definitions(v8pp PUBLIC ${V8PP_DEFINES})
target_compile_options(v8pp PRIVATE ${V8PP_COMPILE_OPTIONS})
target_compile_options(v8pp PUBLIC ${V8PP_COMPILE_OPTIONS})
target_include_directories(v8pp PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
Expand Down

2 comments on commit 6611145

@arghness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ideal, as other projects linking against v8pp::v8pp will inherit -fno-rtti -Wall -Wextra -Wpedantic as well as -fexceptions.
-fno-rtti can cause issues with many C++ features and libraries, in particular. Would the MacOS fix work if most of these options were still kept private, with just -fexceptions being public?

@pmed
Copy link
Owner Author

@pmed pmed commented on 6611145 Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks!

Unfortunately it seems that on macOS -fno-rtti is needed to be public the v8pp is a shared library, and -fexceptions has no effect at all. I'm going to make the -fno-rtti public only for macOS build.

Please sign in to comment.